zoukankan      html  css  js  c++  java
  • 自定义Navigation按钮及Title

    导航栏自带的按钮,时常不能满足要求,所以深深需要进行各种定制.

    写一个UINavigationItem的category

    // UINavigationItem+CB_ChangeButton.h

    
@interface UINavigationItem (CB_ChangeButton)
    
    - (void) CB_SetRightButton:(UIButton *)button;
    
    - (void) CB_SetLeftButton:(UIButton *)button;
    
    - (void) CB_SetNavigationTitle:(NSString *)title;
    
    
    @end

     

    //  UINavigationItem+CB_ChangeButton.m

    
#import "UINavigationItem+CB_ChangeButton.h"
    
    @implementation UINavigationItem (CB_ChangeButton)
    
    - (void) CB_SetRightButton:(UIButton *)button {
        
        UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView: button];
        self.rightBarButtonItem = rightItem;
    }
    
    - (void) CB_SetLeftButton:(UIButton *)button {
        
        UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView: button];
        self.leftBarButtonItem = leftItem;
    }
    
    - (void) CB_SetNavigationTitle:(NSString *)title {
        
        UILabel *label = [[UILabel alloc] initWithFrame: CGRectMake( 0, 0, 320, 44)];
        label.text = title;
        label.textColor = [UIColor whiteColor];
        label.font = FONT;
        label.textAlignment = NSTextAlignmentCenter;
        self.titleView = label;
    }
    
    @end

  • 相关阅读:
    Flink开发中的问题
    怎么确定一个Flink job的资源
    Flink统计日活
    Flink读取resource资源文件
    Spark-6-如何缓解消除数据倾斜
    Spark-5-如何定位导致数据倾斜的代码
    Spark-4-为何要处理数据倾斜
    集合遍历删除中遇到问题
    1206
    1205
  • 原文地址:https://www.cnblogs.com/jz319/p/3729283.html
Copyright © 2011-2022 走看看