How to get a uinavigation bar back button to return to anthother view controller

前端 未结 5 1681
Happy的楠姐
Happy的楠姐 2021-01-16 04:00

How would I go about having a UINavigation controller navigate not to the previous view but the view before that. Basically I would like it to jump back 2 places instead of

5条回答
  •  伪装坚强ぢ
    2021-01-16 04:07

    If you have three view controllers in NavigationController and currently you are viewing 3rd view controller and if you want to jump to 1st viewcontroller.

    Try this. This will navigate you twice back.

    [self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES];
    

    Set appropriate value instead of 0 in your case.

提交回复
热议问题