• navigationbar的一些设置记录


    1.设置navigationbar背景颜色

    [[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];

    PS:如果颜色不对,可能是因为默认的半透明玻璃效果导致的,要关闭使用

    self.navigationController.navigationBar.translucent = NO;

    再PS:如果修改了颜色一点反应都没,则需要隐藏/显示

     

    2.设置按钮颜色

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

     

    3.设置标题颜色及大小

    方法1:

    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 144)];

        title.text = @"帮助";

        title.textAlignment = NSTextAlignmentCenter;

        title.textColor = [UIColor whiteColor];

        title.font = [UIFont systemFontOfSize:20];

        self.navigationItem.titleView = title;

     

    方法2:

    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor,[UIColor colorWithRed:0 green:0.7 blue:0.8 alpha:1], UITextAttributeTextShadowColor,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset,[UIFont fontWithName:@"Arial-Bold" size:0.0],UITextAttributeFont,nil]];

     

    4.navigationbar默认高度为44

  • 相关阅读:
    为什么new的普通数组用delete 和 delete[]都能正确释放
    虚幻4属性系统(反射)
    CFileDialog类的默认路径
    把单一元素的数组放在一个struct的尾端
    在UE4中使用SVN作为source control工具
    单精度浮点数和有效位数为什么是7位
    Valid Number--LeetCode
    归并排序
    堆排序
    直接选择排序
  • 原文地址:https://www.cnblogs.com/punkrocker/p/4147654.html
Copyright © 2020-2023  润新知