我尝试了一些方法来更改后退按钮,但我最终使用three20样式创建了自定义后退按钮。它使用形状而不是UIImage,因此它看起来非常原生。
在应用样式表,我有这个样式类:
///////////////////////////////////////////////////////////////////////////////////////////////////
- (TTStyle*)grayBackwardButton:(UIControlState)state {
TTShape* shape = [TTRoundedLeftArrowShape shapeWithRadius:4.5];
UIColor* tintColor = RGBCOLOR(102, 102, 102);
return [TTSTYLESHEET toolbarButtonForState:state shape:shape tintColor:tintColor font:nil];
}
然后我创建了一个TTButton同时隐藏的标准后退按钮。
[self.navigationItem setHidesBackButton:YES];
TTButton* backButton = [TTButton
buttonWithStyle:@"grayBackwardButton:"
title:NSLocalizedString(@"BACK", @"")];
backButton.frame = CGRectMake(0,0,55,32);
[backButton addTarget:self action:@selector(dismissPlayer) forControlEvents:UIControlEventTouchUpInside];