设置返回按钮的文字与背景
UIImage *backButtonImage = [[UIImage imageNamed:@"Graphics/Shared/navigation_back_button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, backButtonImage.size.height*2) forBarMetrics:UIBarMetricsDefault];
设置导航栏的背景颜色
[[UINavigationBar appearance] setBarTintColor: 颜色];
设置标题的自定义格式
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,[UIFont fontWithName:@"HelveticaNeue-Bold" size:20.0f],UITextAttributeFont, nil]];
本文介绍如何使用UIKit自定义iOS应用中的导航栏样式,包括设置返回按钮的文字与背景、导航栏背景颜色及标题的字体样式。
8706

被折叠的 条评论
为什么被折叠?



