iPhone - Creating a simple UINavigationBar with a Back button using Interface Builder
No complex things here. I've added in my xib a navigationBar, and I'd like to add a "back" button on its left. But nothing works. I've added "many" other buttons, but I can't achieve adding this one...
Do you开发者_JS百科 know how I may do ?
You can either add text or a small image for the back button.
In the viewDidLoad
scope, add:
/* add an image */
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
[backButton setImage:[UIImage imageNamed:@"back.png"]];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
/* add text */
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
[backButton setText:@"Back"];;
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
精彩评论