iPhoneX适配随笔

1、安全区域

 2、NavigationBar 和 TabBar的xib示意图

  两个View要相同的效果,坐标不同

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn.frame = CGRectMake(CScreenWidth/2-44, 88, 88, 88  );iPhone X 相差24
    btn.frame = CGRectMake(CScreenWidth/2-44, 64, 88, 88  );
    btn.backgroundColor = [UIColor redColor];
    [self.view addSubview:btn];
    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn1.frame = CGRectMake(CScreenWidth/2-83/2, CScreenHeight-83-83, 83, 83  ); iPhone X 相差35
    btn1.frame = CGRectMake(CScreenWidth/2-83/2, CScreenHeight-48-83, 83, 83  );
    btn1.backgroundColor = [UIColor redColor];
    [self.view addSubview:btn1];

iPhone X 的xib示意图iPhone X 的xib示意图

普通iPhone的xib示意图

原文地址:https://www.cnblogs.com/xianfeng-zhang/p/7562290.html