标签:ios modal rootviewcontroller
1.模态视图的静态工厂方法调用:
+ (void)dismiss
{
UIWindow *window;
window = [UIApplication sharedApplication].keyWindow;
if([window.rootViewController isKindOfClass:[ASDepthModalViewController class]])
{
ASDepthModalViewController *controller;
controller = (ASDepthModalViewController *)window.rootViewController;
[controller dismiss];
}
}
2.调用实力变量的模态视图转化函数
- (void)dismiss
{
[UIView animateWithDuration:kModalViewAnimationDuration
animations:^{
self.coverView.alpha = 0;
self.rootViewController.view.transform = CGAffineTransformIdentity;
self.popupView.transform = self.initialPopupTransform;
}
completion:^(BOOL finished) {
[self restoreRootViewController];
}];
}
3.重新修改根视图控制器:
- (void)restoreRootViewController
{
UIWindow *window;
window = [UIApplication sharedApplication].keyWindow;
[self.rootViewController.view removeFromSuperview];
self.rootViewController.view.transform = window.rootViewController.view.transform;
window.rootViewController = self.rootViewController;
}
标签:ios modal rootviewcontroller
原文地址:http://blog.csdn.net/yuyezhulan/article/details/40889577