Instead of push segue how to replace view controller (or remove from navigation stack)?

前端 未结 14 879
眼角桃花
眼角桃花 2020-11-28 01:46

I have a small iPhone app, which uses a navigation controller to display 3 views (here fullscreen):

\"Xcode

14条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 02:47

    Use below code last view controller You can use other button or put it your own instead of cancel button i have used

    - (void)viewDidLoad
    {
     [super viewDidLoad];
    
     [self.navigationController setNavigationBarHidden:YES];
    
     UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismiss:)];
    
    self.navigationItemSetting.leftBarButtonItem = cancelButton;
    
    }
    
    - (IBAction)dismissSettings:(id)sender
    {
    
    // your logout code for social media selected
    [self.navigationController popToRootViewControllerAnimated:YES];
    
    }
    

提交回复
热议问题