(1)如果是使用系统导航栏则设置其translucent属性即可:
[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
self.navigationController.view.backgroundColor = [UIColor whiteColor];
(2)若是自定义之UIView 作为页面顶部之导航栏,则使用UIToolBar 与 tableView 之contentInset即可实现:
blur效果:
UIToolbar *naviBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.statusBarOffset, self.view.frame.size.width, self.navigationBarHeight)];
naviBar.barTintColor = NAVI_COLOR_GRAY;
内容穿越导航栏效果:
self.tableView.contentInset = UIEdgeInsetsMake(self.navigationBarHeight, 0, 0, 0); self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(self.navigationBarHeight, 0, 0, 0);
本文出自 “原石诞生璞玉” 博客,请务必保留此出处http://ymbian.blog.51cto.com/725073/1682238
原文地址:http://ymbian.blog.51cto.com/725073/1682238