码迷,mamicode.com
首页 > 移动开发 > 详细

在iOS上present一个半透明的viewController

时间:2014-10-30 15:11:36      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   os   ar   sp   div   on   

UIViewController *viewController = [[UIViewController alloc]init];
UIViewController* controller = self.view.window.rootViewController;
viewController.view.backgroundColor
= [UIColor blackColor]; viewController.view.alpha = 0.5f; controller.modalPresentationStyle = UIModalPresentationCurrentContext; [controller presentViewController:viewController animated:NO completion:nil];

UIViewController 页面

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGesture:)];

[self.view addGestureRecognizer:tapGesture];

 

- (void)tapGesture:(UITapGestureRecognizer *)gesture

{

    [self dismissViewControllerAnimated:YES completion:nil];

}

 

 

在iOS上present一个半透明的viewController

标签:style   blog   io   color   os   ar   sp   div   on   

原文地址:http://www.cnblogs.com/joesen/p/4062533.html

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