簡體   English   中英

如何在iOS 8上為clearview制作clearColor

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM