标签:csdn tom set art cte ios7 button ring 坐标
self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#2295f2"];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn-menu-h"] style:UIBarButtonItemStylePlain target:self action:@selector(menuBtnClick)];
self.navigationItem.leftBarButtonItem.imageInsets = UIEdgeInsetsMake(0,-20,0,0); self.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(0,-10,0,10);
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes =@{NSForegroundColorAttributeName: [UIColor colorWithHexString:@"#ffffff"],NSFontAttributeName:[UIFont systemFontOfSize:15]};
[self.navigationItem.rightBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithHexString:@"#ffffff"],NSFontAttributeName:navItermFont} forState:UIControlStateNormal];
[UINavigationBar appearance].translucent = NO;
self.edgesForExtendedLayout = UIRectEdgeNone;
#import @interface CustomNav : UIView @property(nonatomic,strong)UIButton *buttonLeft; @property(nonatomic,strong)UIButton *buttonRight; - (id)initWithTitle:(NSString *)title; @end #import "CustomNav.h" @implementation CustomNav - (id)initWithTitle:(NSString *)title { self=[super init]; if (self) { self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 64); ##标题 UILabel *titleLabel = [[UILabel alloc]init]; titleLabel.frame = CGRectMake(SCREEN_WIDTH/4.0, 22, SCREEN_WIDTH/2.0, 40); titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.textColor = [UIColor colorWithHexString:@"#ffffff"]; titleLabel.font = [UIFont systemFontOfSize:17]; titleLabel.text = title; [self addSubview:titleLabel]; ##左按钮 self.buttonLeft = [UIButton buttonWithType:UIButtonTypeCustom]; self.buttonLeft.frame = CGRectMake(0, 22, 40, 40); [self addSubview:self.buttonLeft]; self.buttonLeft.titleLabel.font = [UIFont systemFontOfSize:15]; self.buttonLeft.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; ##右按钮 self.buttonRight = [UIButton buttonWithType:UIButtonTypeCustom]; self.buttonRight.frame = CGRectMake(SCREEN_WIDTH - 40, 22, 40, 40); [self addSubview:self.buttonRight]; self.buttonRight.titleLabel.font = [UIFont systemFontOfSize:15]; self.buttonRight.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; self.backgroundColor = [UIColor colorWithHexString:@"#2295f2"]; } return self; } @end
导航条的自定义:背景颜色设置,按钮标题图片设置,图片坐标修改
标签:csdn tom set art cte ios7 button ring 坐标
原文地址:http://www.cnblogs.com/weiboyuan/p/5991777.html