zoukankan      html  css  js  c++  java
  • iOS导航栏配置问题

    1:导航栏

    //更改状态栏,但是需要加字段 View controller-based status bar appearance == NO 默认是YES

        //[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

        //1.设置导航条的颜色

        self.navigationController.navigationBar.barTintColor = [UIColor redColor];

        //2.关闭导航条的毛玻璃效果.

    //    self.navigationController.navigationBar.translucent = YES;

        //3.隐藏导航条

        self.navigationController.navigationBar.hidden = NO;

        //4.设置导航条内容的渲染颜色

        self.navigationController.navigationBar.tintColor = [UIColor purpleColor];

        //5.设置导航条的背景图片.

        //图片尺寸不一样,显示的效果是不同的;(一定要非常严格)

        //    [self.navigationController.navigationBar setBackgroundImage:<#(UIImage *)#> forBarMetrics:<#(UIBarMetrics)#>];

        //6.设置导航条标题文字的大小和颜色

        NSDictionary *dic = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],                            NSForegroundColorAttributeName:[UIColor redColor]};

        self.navigationController.navigationBar.titleTextAttributes = dic;

    2:

    /**

     *  针对当前一个界面单独定制导航条内容

     */

    - (void)customizedNavigationBarContent {

         //配置导航条上显示的标题

         self.navigationItem.title = @"第一个界面";

         //配置导航条的标题视图

         UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:@[@"国家", @"地区"]];

         self.navigationItem.titleView = segment;

         //配置左边内容,显示废纸篓按钮

         UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(handleTrash:)];      self.navigationItem.leftBarButtonItem = leftItem;

         //配置右边内容

         UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleAdd:)];

         self.navigationItem.rightBarButtonItem = rightItem;

     }

    /**

     * //在对navigationBar进行设置时,比如添加一个scrollView,系统会自动将ScrollView下移偏离TOP 64个像素点,为了避免这样,我们有两种方法:

     1.将navigationBar的毛玻璃效果关闭;

     2.将navigationBar的属性automaticallyAdjustsScrollViewInsets = NO;

  • 相关阅读:
    node读写文件
    idea下建立bootstrap项目
    webpack
    Bootstrap-javascript插件
    Bootstrap-other内置组件
    Centos 修改当前路径显示为全路径
    深入理解java虚拟机(4)类加载的过程
    深入理解java虚拟机(3)垃圾收集器与内存分配策略
    深入理解java虚拟机(2)
    Scala学习笔记(3)
  • 原文地址:https://www.cnblogs.com/guofuzhang/p/5269526.html
Copyright © 2011-2022 走看看