解决方法
我认为达到目标的最佳方法是将UINavigationBars设为backIndicator
Image,使其中包含空格的箭头图像.您可以掩盖您的图像,因此文本能够流入图像的部分.
UINavigationBar *navigationBar = ...; navigationBar.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Activity" style:UIBarButtonItemStylePlain target:nil action:nil]; navigationBar.backIndicatorImage = [UIImage imageNamed:@"arrow-image"]; navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"arrow-image-mask"];
AppCoda写了一篇关于定制UINavigationBarin iOS7的伟大文章.值得一读:
http://www.appcoda.com/customize-navigation-status-bar-ios-7/
据文档说,您必须设置BOTH属性才能使其运行:https://developer.apple.com/library/ios/documentation/uikit/reference/uinavigationbar_class/Reference/UINavigationBar.html#//apple_ref/occ/instp/UINavigationBar/backIndicatorImage