【发布时间】:2016-08-16 10:07:42
【问题描述】:
我想创建一个具有透明背景的模态视图控制器,但是当我尝试将背景的 alpha 设置为 0.5 时,它只会让其后面的视图完全变黑。这是因为背景视图在转换后被移除。
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self setModalPresentationStyle:UIModalPresentationFullScreen];
[self setDefinesPresentationContext:YES];
然后呈现视图控制器代码
SecondViewController *alertView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self presentViewController:alertView animated:YES completion:nil];
请看链接 image/linke.gif
【问题讨论】:
-
完全是@JamesP ..
标签: objective-c xcode uiviewcontroller