美文网首页
iPhone X适配

iPhone X适配

作者: iOS扫地僧 | 来源:发表于2017-11-07 15:25 被阅读0次

    适配iPhone x 底栏高度(83:49)

    #define TabbarHeight     ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49) 
    

    适配iPhone x 状态栏高度(44:20)

    #define statusBarHeight   [[UIApplication sharedApplication] statusBarFrame].size.height
    

    适配iPhone x 顶栏高度(88:64)

    #define navStatusHeight   ([[UIApplication sharedApplication] statusBarFrame].size.height>20?88:64)
    

    tableView适配

    if (@available(iOS 11.0, *)) {
        self.home_collectionView.contentInsetAdjustmentBehavior = UIApplicationBackgroundFetchIntervalNever;
    } else {
        self.automaticallyAdjustsScrollViewInsets = false;
        // Fallback on earlier versions
    }
    
    宏定义形式
    
    #define AdjustsScrollViewInsetNever(controller,view) if(@available(iOS 11.0, *)) {view.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;} else if([controller isKindOfClass:[UIViewController class]]) {controller.automaticallyAdjustsScrollViewInsets = false;}
    

    相关文章

      网友评论

          本文标题: iPhone X适配

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