我想为导航栏的后退按钮设置默认行为,因此整个应用程序看起来都是一样的。我还想删除我已经想到的默认文本。
我尝试了以下但没有成功:
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"icon_backarrow"]];
//set default back text to @""
答案 0 :(得分:0)
您应该使用 UIBarButtonItem
UIImage *backButtonImage = [[UIImage imageNamed:@"icon_backarrow"]
resizableImageWithCapInsets:UIEdgeInsetsMake(4, 5, 4, 5)];
// Back button nav bar items
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage
forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage
forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-2.0f, 1.0f)
forBarMetrics:UIBarMetricsDefault];