1.需要设置导航条透明度时
UIImage *image = [UIImage imageNamed:@"bg_clear.png"];
//设置背景颜色
[nav2.navigationBar setShadowImage:image];
[nav3.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
//导航条阴影线
[nav3.navigationBar setShadowImage:image];
2下面是iOS7.0之后默认的属性(表示透明度为yes)
self.navigationController.navigationBar.translucent = YES;
此时坐标self.view.frame.origin.y从0开始(屏幕最上部)。
3.此时若是添加代码self.edgesForExtendedLayout = UIRectEdgeNone
(iOS7.0以后方法);
self.view.frame.origin.y会下移64像素至navBar下方开始。self.edgesForExtendedLayout = UIRectEdge.None;
将view下移64,另外如果有tabBar,高度会缩减40,无需我们手动设置
4.解决ScrollView子视图向下偏移64像素的的问题:
//解决scrollView偏移问题
self.automaticallyAdjustsScrollViewInsets = NO;
self.automaticallyAdjustsScrollViewInsets = NO;
5.解决scrollView被tabbar遮挡的问题
//scrollView被遮挡处理
if ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0) {
self.scrollView.contentInset =UIEdgeInsetsMake(0,0,49, 0);
}
if ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0) {
self.scrollView.contentInset =UIEdgeInsetsMake(0,0,49, 0);
}