标签:
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc]
initWithTitle:@"返回"
style:UIBarButtonSystemItemCancel
target:self
action:@selector(doClickBackAction:)];
self.navigationItem.backBarButtonItem = leftBarButtonItem;
UIImage* backImage = [UIImage imageNamed:@"btn_back.png"];
CGRect backframe = CGRectMake(0,0,54,30);
UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
[backButton setBackgroundImage:backImage forState:UIControlStateNormal];
[backButton setTitle:@"直播" forState:UIControlStateNormal];
backButton.titleLabel.font=[UIFont systemFontOfSize:13];
[backButton addTarget:self action:@selector(doClickBackAction:)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] init];
self.navigationItem.leftBarButtonItem = leftBarButtonItem;
[leftBarButtonItem release];
[backButton release];
其实导航栏中所有按钮都可以采用方法而进行自定义。
标签:
原文地址:http://www.cnblogs.com/stevenwuzheng/p/5400939.html