zoukankan      html  css  js  c++  java
  • 使用edgesForExtendedLayout遇到的麻烦

       今天在写一个多界面之间来回返回的工程时,遇到的问题,建了两个类: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) 的时候,导航栏默认的是半透明颜色,所以需要如上设置就好。

  • 相关阅读:
    第六章:面向对象(下)
    第四章:流程控制和数组
    第三章:数据类型和运算符
    第二章:理解面向对象
    数据库:表设计阶段
    第一章:java语言概述与开发环境
    HTML DOM
    补漏
    不错的资源哦
    阻止事件冒泡
  • 原文地址:https://www.cnblogs.com/cnrong/p/4852346.html
Copyright © 2011-2022 走看看