自定义navigationItem与button的几种状态

时间:2015-05-24 20:22:15   收藏:0   阅读:852

self.navigationItem.rightBarButtonItem = [UIBarButtonItem alloc] initWithCustomView:button];

前提要创建一个UIButton *button;button的内容(图片、颜色等)可以自定义。

这样就实现了自定义navigationItem的rightBarButtonItem或者leftBarButtonItem的自定义了。

 

button的状态设置参考:

[button setTitle:@"按钮" forState:UIControlStateNormal];

[button setTitleColor:[UIColor redColor] forState:UIcontrolStateNormal];

[button setTitleColor:[UIColor orangeColor forState:UIControlStateHighLighted];

[button setTitleColor:[UIColor lightGrayColor forState:UIControlStateDisable];

 

自定义完实现按钮状态可以通过button的enable属性来设置,例如:self.navigationItem.rightBarButtonItem.enable = NO;为不可用状态。enable设置为YES为可用状态。

原文:http://www.cnblogs.com/JackLiao/p/4526308.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!