首页 > 其他 > 详细

使用edgesForExtendedLayout遇到的麻烦

时间:2015-10-02 17:14:57      阅读:159      评论:0      收藏:0      [点我收藏+]

   今天在写一个多界面之间来回返回的工程时,遇到的问题,建了两个类:FirstViewController 和 ButtonViewController。

   由 FirstViewController 进入 ButtonViewController,我在 FirstViewController.m 和 ButtonViewController.m 中分别使用:

self.navigationController.navigationBarHidden = YES;  //  隐藏导航栏     FirstViewController.m 中
self.navigationController.navigationBarHidden = NO; // 恢复该页面导航栏 ButtonViewController.m 中

此时,以为这样可以好了,当打开模拟器,发现 ButtonViewController 界面中的contentView的部分被导航栏遮住了,所以在baidu.com之后参考http://blog.csdn.net/cny901111/article/details/26529949使用了如下代码:

self.edgesForExtendedLayout = UIRectEdgeNone;  

但是问题又来了,在模拟器上运行的时候,发现进入 ButtonViewController 时导航栏位置出现了"卡顿"现象,解决代码如下:

//
 self.edgesForExtendedLayout = UIRectEdgeNone;

// 改为:
self.navigationController.navigationBar.translucent = NO;
 self.tabBarController.tabBar.translucent = NO;

即可。当没有设置 translucent(默认的是YES) 的时候,导航栏默认的是半透明颜色,所以需要如上设置就好。

使用edgesForExtendedLayout遇到的麻烦

原文:http://www.cnblogs.com/cnrong/p/4852346.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!