IOS UIApplication 可以做得事情、

直接上代码,里面注释相对详细。

@interface ViewController ()
- (IBAction)applicationAction:(id)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor greenColor]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)applicationAction:(id)sender {
    UIApplication *app=[UIApplication sharedApplication];
    //1.改变App图标右上角的数字显示,0表示不显示.
    app.applicationIconBadgeNumber=0;
    //ios8以上,需要注册registerUserNotification授权才可以改变
    UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
    
    //2.设置是否显示联网指示
    app.networkActivityIndicatorVisible=YES;
    
    //3.通过UIApplication管理。统一设置,只能设置一次,有动画;
    app.statusBarHidden=YES;
    [app setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    app.statusBarStyle=UIStatusBarStyleLightContent;
    [app setStatusBarStyle:UIStatusBarStyleLightContent animated:UIStatusBarAnimationSlide];
    
    //4.可以打开URL---打电话,发送短信,打开网页,邮件,打开其他app程序 都是打开URL的操作
    //打电话
    [app openURL:[NSURL URLWithString:@"tel://10086"]];
    
    //发短信
    [app openURL:[NSURL URLWithString:@"sms://10086"]];
    
    //发邮件
    [app openURL:[NSURL URLWithString:@"mailto://12345@qq.com"]];
    
    //打开一个网页资源
    [app openURL:[NSURL URLWithString:@"http://ios.itcast.cn"]];
    
    //打开其他app程序   openURL方法,可以打开其他APP。
}

//通过UIViewController管理。每个界面都可以设置一个不同的状态,无动画;

-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

-(BOOL)prefersStatusBarHidden{
    return NO;
}
@end


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值