Reputation: 3240
In my app i got view, where user adds new object, then he clicks on the "save" button and goes to main view. But after that we see "back" button on the main view. Can i do this segue (new object -> main window) without "back" button?
Upvotes: 4
Views: 9573
Reputation: 53
In case anyone else is having trouble getting this to work,
'self.navigationItem.hidesBackButton = YES;'
didn't work for me when placed in
'- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil'
.
I moved it to '- (void)viewDidLoad'
and it now works perfectly. I'm using Xcode 4.5.2.
Upvotes: 3
Reputation: 2297
If you are navigating from VC1 to VC2. If you want hide back button when you goto VC2.
Just write this in VC2
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.navigationItem.hidesBackButton = YES;
}
return self;
}
OR
- (id)init
{
self = [super init];
if (self) {
self.navigationItem.hidesBackButton = YES;
}
return self;
}
Upvotes: 14
Reputation: 2256
- (IBAction)done:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
Then connect it to a button.
Upvotes: 0
Reputation:
Set self.navigationItem.hidesBackButton = YES
on the pushed view controller.
Upvotes: 1