[英]How to make a clearColor for superview on iOS 8
请帮助。 如何在iOS 8上为模式视图制作清晰的颜色,写成
self.view.superview.backgroundColor = [UIColor clearColor];
在iOS 7上可以运行,但不能在iOS 8上运行。
尝试像这样更改alpha值:-
[[UIColor clearColor] colorWithAlphaComponent:0.6];
如果您为UIViewController主视图设置背景色,则需要先进行设置:
- (void)setupModalPresentationStyle
{
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
}
}
- (void)awakeFromNib
{
[super awakeFromNib];
[self setupModalPresentationStyle];
}
当您展示此UIViewController时,您需要设置当前展示的UIViewController:
- (void)doneButtonTap:(id)sender {
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:detailsViewController animated:YES completion:nil];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.