您的位置:首页 > 移动开发 > IOS开发

iOS7导航控制器自定义返回按钮

2015-07-10 16:27 435 查看
- (void)viewDidLoad
{

[super viewDidLoad];

[self.navigationController.navigationBar setTitleTextAttributes:@{UITextAttributeTextColor: [UIColor redColor],UITextAttributeFont:[UIFont systemFontOfSize:19.]}];

//自定义返回按钮
UIImage *backButtonImage = [[UIImage imageNamed:@"fanhui.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 30, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

//将返回按钮的文字position设置不在屏幕上显示
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin) forBarMetrics:UIBarMetricsDefault];
self.title=[NSString stringWithFormat:@"第%lu页",self.navigationController.viewControllers.count];
// Do any additional setup after loading the view from its nib.
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: