UIViewController弹出一个透明的UIViewController

在第一个UIViewController事件中


 TestController *tView = [[TestController alloc] init];

    //设置模式展示风格

    [tViewsetModalPresentationStyle:UIModalPresentationOverCurrentContext];

    //必要配置

    self.modalPresentationStyle = UIModalPresentationCurrentContext;

    self.providesPresentationContextTransitionStyle = YES;

    self.definesPresentationContext = YES;

    [self presentViewController:tView animated:NO completion:nil];



在弹出的TestController.m中重写

#define DeviceHeight [[UIScreen mainScreen] bounds].size.height

#define DeviceWidth [[UIScreen mainScreen] bounds].size.width

/**

 *  设置位置宽高

 */

- (void)viewWillLayoutSubviews {

    self.view.frame = CGRectMake(0, 0, DeviceWidth, DeviceHeight);

    self.view.backgroundColor = [UIColor colorWithWhite:0.5 alpha:.5];

    //self.view.backgroundColor = [UIColor clearColor];

    //self.view.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:0.868f];

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容