I have 2 page. first is tableView and second is view when I to click on any cell go on to next page (view) in way modal segue. I want add back button in next page of navigation bar . this is my code in view page : ViewController.m
- (void)viewDidLoad { [super viewDidLoad]; self.lable.text = obji.Name; self.lable2.text = obji.Descript; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(Back)]; self.navigationItem.leftBarButtonItem = backButton; } - (IBAction)Back { //I dont know that how return pervious page }
Storyboard. You can also set this in the Storyboard. Select UINavigationBar and select the Attributes Inspector tab. Then you can change those two images under Back and Back Mask attributes.
Example ExplainedUse any element to open the dropdown menu, e.g. a <button>, <a> or <p> element. Use a container element (like <div>) to create the dropdown menu and add the dropdown links inside it. Wrap a <div> element around the button and the <div> to position the dropdown menu correctly with CSS.
As you said in your comment you use a modal controller
Add the following in viewWillappear
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style: UIBarButtonItemStyleBordered target:self action:@selector(Back)]; self.navigationItem.leftBarButtonItem = backButton;
And in
- (IBAction)Back { [self dismissViewControllerAnimated:YES completion:nil]; // ios 6 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With