码迷,mamicode.com
首页 > 其他好文 > 详细

模态视图和父视图之间转换的方法

时间:2014-11-07 11:21:19      阅读:159      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!