坐标:表示屏幕物理尺寸大小,坐标变大了,表示机器屏幕尺寸变大了;html
像素:表示屏幕图片的大小,跟坐标之间有个对应关系,好比1:1或1:2等;ios
ppi:表明屏幕物理大小到图片大小的比例值,若是ppi不变,则坐标和像素的比例不会变;git
引用一段文字说的很好: github
“不是现有的屏幕物理分辨率明显超过了 @2x 但还达不到 @3x 的水平么?那咱们歪打正着一个知足 @3x 的屏幕总能够吧?
对的,歪打正着。
程序在 iPhone 6 Plus 上运行的时候,iOS 会骗它说,你运行在一个超大的 @3x Retina 显示屏上,物理分辨率高达 1242 x 2208,逻辑分辨率是 414 x 736,二者都比 iPhone 6 要大。而后做为设计师和开发人员,也跟着一块儿歪打正着。设计师画图的时候要把屏幕当成 1242 x 2208 来画图(并且要提供@3x 的高清图),开发人员也按照 414 x 736 的逻辑分辨率来写程序。
但借来的总要还的。等我们歪歪结束了之后,iOS 拿到这个假大的 UI 绘制结果,实时地再缩小到实际的 1080 x 1920 分辨率(系统经过某种算法)。因而,用户在 iPhone 6 Plus 的屏幕上看到的永远是被缩小了的图像:算法
这么作使得设计和开发的过程大大简化,且最后的实际缩放系数 @2.62x 很是接近理想的 @2.46x,使得一样的素材在真机上看起来尺寸也很是合理。xcode
在新特性界面中,根据:[UIScreen mainScreen].bounds.size.height.来判断用户的屏幕长度,来判断时3.5寸,4 寸,4.7寸,5.5寸,以此来设置新特性中图片选用哪套。安全
经常使用写法:网络
#define kScreenWidth [UIScreen mainScreen].bounds.size.widthapp
CGFloat btnW =kScreenWidth * 1/4;less
对于iOS,Bitcode是可选的;对于watchOS,Bitcode是必须的;而Mac OS是不支持Bitcode。
若是咱们开启了Bitcode,在提交程序到AppStore时,会看到有Bitcode的选项
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
写在
-layoutSubviews
中:
-(void)layoutSubviews{
[super layoutSubviews]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; }
现象: [tableView reloadData]
无效,有一行 cell 明明改变了可是刷新不出来。
感受多是这个方法和某种新加的特性冲突了,猜想多是 reloadData
的操做被推迟到下一个 RunLoop
执行最终失效。
解决的方法是,注释 [tableView reloadData]
,改用局部刷新:
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
这两个推测均属 Xcode7 的bug,未来 Apple 确定会修复。
【项目中关于iOS9的适配暂时遇到这么多,若是你还想了解更多详情,请参照以下教程: iOS9适配系列教程】。/** 消息推送 **/ - (void) msgPush { //推送的形式:标记,声音,提示 if (IS_IOS8) { //1.建立消息上面要添加的动做(按钮的形式显示出来) UIMutableUserNotificationAction *action = [[UIMutableUserNotificationAction alloc] init]; action.identifier = @"action";//按钮的标示 action.title=@"Accept";//按钮的标题 action.activationMode = UIUserNotificationActivationModeForeground;//当点击的时候启动程序 // action.authenticationRequired = YES; // action.destructive = YES; UIMutableUserNotificationAction *action2 = [[UIMutableUserNotificationAction alloc] init]; action2.identifier = @"action2"; action2.title=@"Reject"; action2.activationMode = UIUserNotificationActivationModeBackground;//当点击的时候不启动程序,在后台处理 action.authenticationRequired = YES;//须要解锁才能处理,若是action.activationMode = UIUserNotificationActivationModeForeground;则这个属性被忽略; action.destructive = YES; //2.建立动做(按钮)的类别集合 UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc] init]; categorys.identifier = @"alert";//这组动做的惟一标示,推送通知的时候也是根据这个来区分 [categorys setActions:@[action,action2] forContext:(UIUserNotificationActionContextMinimal)]; //3.建立UIUserNotificationSettings,并设置消息的显示类类型 UIUserNotificationSettings *notiSettings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIRemoteNotificationTypeSound) categories:[NSSet setWithObjects:categorys, nil]]; [[UIApplication sharedApplication] registerUserNotificationSettings:notiSettings]; }else{ [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert]; } }