首页 > 其他 > 详细

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

时间:2014-11-07 11:18:56      阅读:213      评论:0      收藏:0      [点我收藏+]

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;

}




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

原文:http://blog.csdn.net/yuyezhulan/article/details/40889577

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!