码迷,mamicode.com
首页 > 移动开发 > 详细

iOS适配各版本

时间:2015-09-28 20:38:42      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

1.navigationItem

技术分享
    if (isBeforeIOS7)
    {
        UIButton *yes = [UIButton buttonWithType:UIButtonTypeCustom];
        yes.frame = CGRectMake(0,0,40,40);
        [yes setTitle:@"确定" forState:UIControlStateNormal];
        [yes setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        yes.titleLabel.font=[UIFont systemFontOfSize:16];
        [yes addTarget: self action: @selector(selectItemReturn:) forControlEvents: UIControlEventTouchUpInside];
        UIBarButtonItem*right=[[UIBarButtonItem alloc]initWithCustomView:yes];
        self.navigationItem.rightBarButtonItem=right;
    }else
    {
        UIBarButtonItem *editlButton = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleBordered target:self action:@selector(selectItemReturn:)];
        self.navigationItem.rightBarButtonItem = editlButton;
        self.navigationItem.rightBarButtonItem.enabled = YES;
    }
View Code

2.推送

技术分享
if (isAfterIOS8)
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings
                                                                                 settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
                                                                                 categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
             (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }
View Code

 

iOS适配各版本

标签:

原文地址:http://www.cnblogs.com/liaods/p/4844715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!