A presentViewController 到B 后,A.presentedViewController就是B,B.presentingViewController就是A
还有个属性是parentViewController 但在ios5.0后返回nil
//此时rootVC为当前controller的上一级controller
UIViewController *rootVC = self.presentingViewController;
//判断此时的rootVC是否还有上一级的Controller,如果有,赋为rootVC
while (rootVC.presentingViewController) {
rootVC = rootVC.presentingViewController;
}
[rootVC dismissViewControllerAnimated:NO completion:nil];