This article reprinted from the WeChat public number “Netro Development”, the author’s street angle looks up. Reprinted this article, please contact the public number.
Option One
Custom UinaVigationController compliance “ `agreement implementation below:
#pragmamark ——— UINavigationBarDelegate- (BOOL) navigationBar: (UINavigationBar *) navigationBarshouldPushItem: (UINavigationItem *) item {// returns the button text is provided the navigation UIBarButtonItem * back = [[UIBarButtonItemalloc] initWithTitle: nilstyle: UIBarButtonItemStylePlaintarget: nilaction: nil]; / * NSMutableDictionary * textAttrs = [NSMutableDictionarydictionary]; textAttrs [UITextAttributeTextColor] = [UIColorwhiteColor]; [backsetTitleTextAttributes: textAttrsforState: UIControlStateNormal]; * / item.backBarButtonItem = back; returnYES;}
Note: This method will have a bug that appears in the back button text of the part sub-controller page, and you need to return the button again as above the parent controller of its sub-controller page.
Parent controller pages the sub-controller #pragmamark ——– lifecycle methods – (void) viewDidLoad {[superviewDidLoad]; // Doanyadditionalsetupafterloadingtheview.self.view.backgroundColor = [UIColorwhiteColor]; // reset subordinate Subpage Navigation Bar Back Button Text UibarbuttonItem * Item = [[UibarButtonItemalloc] ITWITHTITE: NILSTYLE: UIBARBARBUTTONITELEPLAINTARGET: NILACTION: NIL]; self.naVigationItem.BackBarButtonItem = item;}
Option II
Custom UINAVIGATIONCONTROLLER Follow Protocol uinavigationBardLegate> implementation following:
#pragmamark ——- uinavigationBardLegate- (bool) NavigationBar: (uinavigation bar *) NavigationBarshouldPushitem: (uinavigationItem *) Item {// Setting the navigation bar Return button text is transparent, may cause the navigation title to not hit the problem [[UIBarButtonItemappearance] setTitleTextAttributes: @ {NSForegroundColorAttributeName: [UIColorclearColor]} forState: UIControlStateNormal]; [[UIBarButtonItemappearance] setTitleTextAttributes: @ {NSForegroundColorAttributeName: [UIColorclearColor]} forState: UIControlStateHighlighted]; returnYES;}
Plan three (recommended)