UIBarButtonItem *backButton =
[[UIBarButtonItem alloc] initWithTitle: @"Back"
style: UIBarButtonItemStyleBordered
target: nil
action: nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
The catch is you need to do it in the parent controller before pushing the subcontroller. You can stick this into the -init and change it once
@implementation BlahViewController
- (id) init {
if ((self = [super initWithNibName: @"BlahViewController"
bundle: nil])) {
// other initialization
}
return self;
} // init
- (id) initWithNibName: (NSString *) nibNameOrNil
bundle: (NSBundle *) nibBundleOrNil {
return [self init];
} // initWithNibName
[self presentViewController: vc animated: YES
completion: ^{
NSLog (@"you complete me");
}];
and to get rid of it
[self dismissViewControllerAnimated: YES completion: ^(void) {
NSLog (@"kompressor does not dance");
}];
[self presentModalViewController: webview animated: YES];
And to get rid of it (maybe from inside of the view controller that just got modalated)
[self dismissModalViewControllerAnimated: YES];