I am trying to add navigation button to top bar in a UITabController but the button isn't showing.
UIBarButtonItem * leftButtonItem = [[UIBarButtonItem alloc] initWithTitle: @"SETTING" style: UIBarButtonItemStyleBordered target: self action: @selector(permanentlyCloseWelcomeView)] ;
[[self navigationItem] setLeftBarButtonItem: leftButtonItem];
Is the view controller inside a UINavigationController? You only get self.navigationItem if it is. Check it in the debugger, I bet it's nil on your second line.
You need to embed the view controller in a navigation controller, or if you just want the bar and not a nav controller, you put the bar button item on your manually-created nav bar.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.