在第一个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];
}
网友评论