zoukankan      html  css  js  c++  java
  • 记录一些容易忘记的属性 -- UINavigationController

      //设置导航栏的风格
        self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
        //设置导航栏是否透明 NO不透明, YES 透明,默认为YES;

        //当导航栏的translucent属性设置为YES,则在当前视图控制器的坐标原点为屏幕左上角
        //当导航栏的translucent属性设置为NO,则在当前视图控制器的坐标原点在屏幕左上角(往Y轴方向距离导航栏的高度(44))
        self.navigationController.navigationBar.translucent =  NO;

        //设置导航栏上导航元素项的颜色
        self.navigationController.navigationBar.tintColor = [UIColor yellowColor];

        //设置导航栏的前景颜色
        self.navigationController.navigationBar.barTintColor = [UIColor cyanColor];

      //隐藏导航栏
        self.navigationController.navigationBarHidden = NO;
        
        //设置导航栏的背景图片
        //UIBarMetricsDefault 肖像画(正屏)
        //UIBarMetricsLandscapePhone 风景画(侧屏)
        [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBarBG1"] forBarMetrics:UIBarMetricsDefault];
        [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBarBG2"] forBarMetrics:UIBarMetricsLandscapePhone];

        //设置导航项的标题视图,这个优先级比下面的两种方式高
        UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
        titleView.backgroundColor = [UIColor purpleColor];
        self.navigationItem.titleView = titleView;
        
        //设置视图控制器的名称
        //这两方式设置的优先级一致,谁后设置,用谁的名字
      1  self.navigationItem.title = @"controllOne";
      2  self.title = @"控制器一";

        //所有的导航元素项放在视图控制器的navigationItem里
        //所有的视图控制器都有自己独立的导航元素项,但是公用一个导航栏

        //裁剪超出边界的部分
        self.navigationController.navigationBar.clipsToBounds = YES;

  • 相关阅读:
    EF4.3 到底能不能用?
    系统架构师(详解+转)
    silverlight MD5加密
    silverlight自定义安装客户端插件
    vs2010中文安装英文版silverlight5,和MVC 3
    如何自定义gridview的表格显示?
    Scott Mitchell的ASP.NET2.0数据指南中文版索引
    成功软件开发者的9种编程习惯(一)
    第8章 商品目录管理
    6/29 项目目录结构有所调整
  • 原文地址:https://www.cnblogs.com/goodheart/p/3991417.html
Copyright © 2011-2022 走看看