UI第五天

特别注意:一个控件对象(不是传值)只有一个父类,如果给一个控件对象赋两个父类,程序会崩。




注意:   

导航栏的高度是44(竖屏)   32(横屏)

状态栏(运营商、时间、电量)的高度是20


一些概念:

1.栈相关:

栈:先进后出

什么是出栈:

将元素从栈中移除的过程,我们称作出栈

什么是入栈:

将元素添加到栈中的过程,我们称作入栈

什么是基栈:

栈中的第一个元素是基栈

什么是栈顶:

栈中的最后一个元素


2.设置导航栏的样式

self.navigationController.navigationBar.barStyle = UIBarStyleDefault;


3.设置导航栏背景颜色,纯色

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


:用[self.navigationController.navigationBar setBackgroundColor:[UIColor purpleColor]];设置的导航栏不是纯色


4.设置导航栏的图片

[self.navigationController.navigationBar setBackgroundImage:

[UIImage imageNamed:@"transformers.jpg"] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];


5.设计状态栏的样式

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    

6.设置导航栏左侧按钮系统样式

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(pressLeftBtn)];


7.设置带标题的按钮

    UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:@"click" style:UIBarButtonItemStylePlain target:nil action:nil];


8.设置带图片的按钮

让图片呈原色显示

    UIImage *image = [[UIImage imageNamed:@"itemImage"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:nil action:nil];

 self.navigationItem.rightBarButtonItems = @[item1,item2];


9.设置导航栏的渲染色,来影响系统文字和图标的颜色 self.navigationController.navigationBar.tintColor = [UIColor blackColor];


10.只有当视图控制器存在于导航控制器的容器中的时候,我们通过 self.navigationController 拿到的导航控制器才是有值的,否者是没有值的

当我们执行了push操作,那么对应的视图控制器就已经添加到我们的导航控制器的容器中,也就是这个操作就是入栈操作


11.buttonUIButtonTypeCustom的情况下 设置高亮 按钮不会变灰

一组操作:

 [buttons setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];

    [buttons setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateHighlighted];


12.自定义按钮设置

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:buttons];


13.设置导航栏的标题

    self.navigationItem.title = @"你是没有";


14.设置自定义标题

    self.navigationItem.titleView

    self.title = @"机会";


15.这个操作就是出栈操作

返回到上一个界面:

    [self.navigationController popViewControllerAnimated:YES];


返回到根视图控制器,也就是基栈:

    [self.navigationController popToRootViewControllerAnimated:YES];


16.通过容器数组拿到视图控制器对象

    UIViewController *vc = self.navigationController.viewControllers[1];


17.返回到指定的视图控制器

    [self.navigationController popToViewController:vc animated:YES];


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值