如何在按钮上更改此标题?
答案 0 :(得分:1)
如果这是来自导航控制器,设置父VC的标题会将按钮的标题设置为该字符串值。
答案 1 :(得分:0)
iOS SDK不允许更改后退按钮的标题。
相反,您可以使用自定义后退按钮替换后退按钮:
+ (void)setBackButtonForViewController:(UIViewController *)vc target:(id)target selector:(SEL)selector
{
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image = [UIImage imageNamed:@"back_button.png"];
[backButton setImage:image forState:UIControlStateNormal];
backButton.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
[backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
vc.navigationItem.leftBarButtonItem = temporaryBarButtonItem;
vc.navigationItem.hidesBackButton = YES;
[temporaryBarButtonItem release];
}
您可以从http://www.teehanlax.com/blog/iphone-4-gui-psd-retina-display/抓取back_button.png图片。