• 自定义navigationItem与button的几种状态


    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为可用状态。

  • 相关阅读:
    Git之不明觉厉11-利其器source tree
    GUI for git|SourceTree|入门基础
    UIButton
    NSDictionary
    注释方法、代码块加快捷键注释
    UIActionSheet
    UIActivityIndicatorView
    UIPickerView
    UIImageView
    UIAlertView
  • 原文地址:https://www.cnblogs.com/JackLiao/p/4526308.html
Copyright © 2020-2023  润新知