iOS-视图切换|及如何判断view controller是push还是present进去

模态化弹出:(视觉效果进入时:从下到上,出去时从上到下)
present和dismiss对应

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion 
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^ __nullable)(void))completion
GOVShareViewController *shareViewController = [[GOVShareViewController alloc] initWithArticle:article];
[self presentViewController:shareViewController animated:NO completion:^(void){
                [shareViewController presented];
            }];
[self dismissViewControllerAnimated:YES completion:nil];

推入:(视觉效果是从右向左滑入,出去时从左到右)
pop 和push对应 (根视图是NavigationController,不然是不可以用的)

 [self.navigationController popViewControllerAnimated:NO];
 [self.navigationController pushViewController:pushController animated:animationPush];

用viewController的属性presentingViewController判断是不是模态化弹出

if (self.presentingViewController ! = nil ){
     @"我是模态化弹出";
}

查找资料发现了一篇关于present的文章记录下来

你可能感兴趣的:(iOS-视图切换|及如何判断view controller是push还是present进去)