ios导航栏和tabbar的坑

多年不写ios,目前重构项目,发现navBar和tabbar需要注意的点,记录备忘

 

translucent属性会导致view起始点的变化,默认为透明,和设计图有色差,改成不透明以后,坐标位置有变化,修改如下

[[UINavigationBar appearance] setTranslucent:NO];
self.extendedLayoutIncludesOpaqueBars = YES;

 

UITabBar类似

[[UITabBar appearance] setTranslucent:NO];    
UIEdgeInsets adjustForTabbarInsets = UIEdgeInsetsMake(0, 0, self.tabBarController.tabBar.frame.size.height, 0);
self.tableView.contentInset = adjustForTabbarInsets;

 

在某些viewController内贴view,可能会有位置错误,可以用下面代码试试

self.edgesForExtendedLayout = UIRectEdgeNone;

具体详解,网上找资料

posted @ 2018-03-08 09:49  自由出土文物  阅读(205)  评论(0编辑  收藏  举报