Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation Controller without a "Back" button

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?

like image 218
Eugene Trapeznikov Avatar asked Dec 02 '22 23:12

Eugene Trapeznikov


1 Answers

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;
}
like image 73
Sanjeev Rao Avatar answered Dec 15 '22 03:12

Sanjeev Rao