문제

I have a problem when setting the background color for a UIView. What I am doing is:

- (void) viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor clearColor];
}

but I am getting a black background color as shown below:

Incorrect Background Color - Illustrated

If I change the background to any another color it works. Any ideas about this ?

도움이 되었습니까?

해결책

Your view is working as intended. You are setting it to use a clear background color, which means exactly as it is named, clear, and you will see color and possibly other UI elements underneath your view. Think of it as placing clear plastic wrap (the view) on top of colored construction paper (the super view). If you wish to find where the black color is coming from, I would start with your root controller's view.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top