导航栏透明设置

在iOS7以后,默认为YES。{控件从(0,0)点开始,设置为NO,则从nav底部(0,64)开始};

显而易见,translucent为默认值YES时,绿色button从屏幕左上角(0,0)开始。translucent设为NO以后,绿色button从(0,64)开始。

也就得出,translucent为YES,控制器view从(0,0)开始;translucent为NO,控制器view从(0,64)开始。

 self.navigationController.navigationBar.translucent =YES;

在translucent为yes的情况,设置一个坐标tableView为(0,0),因为automaticallyAdjustsScrollViewInsets属性默认为yes的关系,tableView会向下偏移64,不被导航栏遮住,如果想要遮住将其设为NO

链接:https://www.jianshu.com/p/428920dd6309

设置标题颜色 :

 [self.navigationController.navigationBar setTitleTextAttributes: @{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];

将导航栏设为透明 :

[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];    

[self.navigationController.navigationBar setShadowImage:[[UIImage alloc]init]];

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容