Back-like arrow on iOS 7

前端 未结 4 1241
深忆病人
深忆病人 2021-02-20 07:14

I need to add a left bar button item in my app that looks like system back button, but is not the system back button, since it will appear on view controller that is the only vc

4条回答
  •  独厮守ぢ
    2021-02-20 07:54

    Consider using a dummy UIViewController as a root view controller for your UINavigationController’s stack:

     [[UINavigationController alloc] initWithRootViewController:[UIViewController new]];
     [navController pushViewController:viewController animated:NO];
    

    Then you can use my BackButtonHandler extension to handle back button action (as described in this thread) :

     -(BOOL) navigationShouldPopOnBackButton {
          [self dismissModalViewControllerAnimated:YES];
          return NO; 
     }
    

提交回复
热议问题