[英]How to make a clearColor for superview on iOS 8
Help please. 请帮助。 How to make a clear Color for modal View on iOS 8, write so
如何在iOS 8上为模式视图制作清晰的颜色,写成
self.view.superview.backgroundColor = [UIColor clearColor];
Work on iOS 7 but not on iOS 8. It becomes clear but not completely 在iOS 7上可以运行,但不能在iOS 8上运行。
尝试像这样更改alpha值:-
[[UIColor clearColor] colorWithAlphaComponent:0.6];
If you set background color for the main UIViewController view, you need to setup it before: 如果您为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];
}
And when you present this UIViewController, you need to setup current presenting UIViewController: 当您展示此UIViewController时,您需要设置当前展示的UIViewController:
- (void)doneButtonTap:(id)sender {
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:detailsViewController animated:YES completion:nil];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.