需求 :
A push B present C push D push E E怎么直接返回到B
ios版本
E的返回事件里:
- (void)youyouClick{
UIViewController *presentVC = self.presentingViewController;
if(presentVC){
[presentVCdismissViewController Animated:YES completion:nil];
if ([presentVC.presentationController isKindOfClass:[BViewController class]]) {
[self.navigationController popToViewController:presentVC animated:YES];
}
}
}
swift版本:
if let presentVC = self.presentingViewController { presentVC.dismiss(animated: true) {} if let destVC = presentVC.presentationController as? TopNewsViewController { self.navigationController?.popToViewController(destVC, animated: true) } }
网友评论