理想效果如下:
初步实现:
正常设置
//设置整个灰色的背景视图
UIView *backgroundView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
backgroundView.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.8];
[self.view addSubview:backgroundView];
发现视图并没有正确的覆盖整个屏幕
后来才发现 需要在 View 的后面加上 Window 这样涉及到的效果就是整个屏幕了
//设置整个灰色的背景视图
UIView *backgroundView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
backgroundView.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.8];
[self.view.window addSubview:backgroundView];
更多精彩文章,尽在我的公众号.