zoukankan      html  css  js  c++  java
  • NavigationBar

    模态View显示NavigationBar

    NavigationBarViewController *navigationBar= [[NavigationBarViewController alloc]init];
    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:navigationBar];
    [self presentViewController:nav animated:YES completion:nil];

    在 NavigationBarViewController 里面对NavigationBar设置

    self.navigationController.navigationBar.translucent = NO;// 是否透明
    [self.navigationItem setTitle:@"旅行"];

    [self.navigationController.navigationBar setBarTintColor:[UIColor redColor]];//背景颜色

    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];//去掉底部线条

    NSDictionary *textAttributes=@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:20]};

    [self.navigationController.navigationBar setTitleTextAttributes:textAttributes];//字体样式

    UIBarButtonItem *leftBar=[[UIBarButtonItem alloc ]initWithTitle:@"Left" style:UIBarButtonItemStyleDone target:self action:nil];
    UIBarButtonItem *leftBar1=[[UIBarButtonItem alloc ]initWithTitle:@"Left" style:UIBarButtonItemStyleDone target:self action:nil];

    UIBarButtonItem *rightBar=[[UIBarButtonItem alloc ]initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:nil];
    UIBarButtonItem *rightBar1=[[UIBarButtonItem alloc ]initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:nil];
    leftBar.width=-10;

    self.navigationItem.leftBarButtonItems=[NSArray arrayWithObjects:leftBar,leftBar1, nil];
    self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:rightBar,rightBar1, nil];
    self.navigationItem.leftBarButtonItem.enabled=NO;//左边button 禁掉 灰色
    [self.navigationController.navigationBar setUserInteractionEnabled:NO]; //所有的button 都是readonly的,颜色不是灰色的

  • 相关阅读:
    ps
    Elasticsearch Java Rest Client API 整理总结 (一)
    "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported"
    hdu1421 搬寝室(dp)
    A题之变态青蛙跳
    11.Laravel5学习笔记:扩展 Validator 类
    HDU 5607 graph(矩阵优化+概率DP)
    《Spring技术内幕》笔记-Spring的设计理念和总体架构
    hihocoder 1124 : 好矩阵 dp
    关于ValueAnimation以及Interpolator +Drawable实现的自己定义动画效果
  • 原文地址:https://www.cnblogs.com/zhangleixy/p/4951604.html
Copyright © 2011-2022 走看看