美文网首页
开发中总结

开发中总结

作者: 亲亲qin | 来源:发表于2018-08-02 11:19 被阅读13次
    • 1、判断是不是iOS11
      oc

      if (@available(iOS 11.0, *)) {
            _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
            
            _tableView.estimatedRowHeight = 0;
            _tableView.estimatedSectionHeaderHeight = 0;
            _tableView.estimatedSectionFooterHeight = 0;
        }
      

    swift

    if #available(iOS 11.0, *) {
            self.tableView.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
    
    • 2、iOS 学习必备的开源项目及库
      *3 声明属性编译器默认会给我们生成对应的私有成员变量,其实属性就是私有成员变量+getter+setter罢了;
      这里我们不考虑幺蛾子情况,比如声明了两个属性year和month,你又写了这样的代码@synthesize year =
      month;那么不好意思,这样的话编译器不会生成_month和_year成员变量了,也不会生成month的getter和setter方法,只会生成一个month成员变量和year的getter和setter方法,操作self.year
      就相当于操作了month成员变量;
      4、别再用 CD 切换目录了

      5、iOS小技巧总结,绝对有你想要的
      6、判断iPhone的尺寸
      JcCJp.png
    #define IS_IPHONE        (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    #define IS_IPHONE_4      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 480.0)
    #define IS_IPHONE_5      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
    #define IS_IPHONE_6      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
    #define IS_IPHONE_6PLUS  (IS_IPHONE && [[UIScreen mainScreen] nativeScale] == 3.0f)
    #define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
    #define IS_IPHONE_X      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0)
    #define IS_IPHONE_XS      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0)
    #define IS_IPHONE_X_MAX      (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 896.0)
    #define IS_RETINA        ([[UIScreen mainScreen] scale] >= 2.0) // 3.0 for iPhone X, 2.0 for others
    #define IS_IPAD_DEVICE   [(NSString*)[UIDevice currentDevice].model hasPrefix:@"iPad"]
    

    iPhoneXs iPhoneXs Max iPhoneXr 界面适配
    iPhoneXS、XS Max与iPhoneXR 适配
    Xcode10 暨iPhoneXS,iPhoneXS Max,iPhoneXR适配小结

    相关文章

      网友评论

          本文标题:开发中总结

          本文链接:https://www.haomeiwen.com/subject/mkcrvftx.html