Reputation: 1239
From View Programming Guide:
"... Windows do not have any visible content themselves but provide a basic container for your application’s views. ..."
What does "visible" mean? I can (without adding any UIViews to the window) set the colour of the window and it will be visible (on simulator) using the following two lines:
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.backgroundColor = [UIColor whiteColor];
If I run my app, it will be white. Hence the question: what does "visible" mean in this context? And if a UIWindow is not supposed to have any visible content then why is it nonetheless implemented as to have an attribute backgroundColor? Thanks for your help.
Upvotes: 1
Views: 66
Reputation: 318824
Most likely, the term "visible content" in the docs means "subviews". The intent is that windows do not provide any subviews, widgets, or any other content. The background color isn't content, it is a property.
Upvotes: 4
Reputation: 6995
UIWindow
is a subclass of UIView
, which is why you'll see the backgroundColor
property. I'm not exactly sure how iOS handles this internally, but I assume that your root view controller's view
property is loaded into the window's view to display content.
Upvotes: 1
Reputation: 12190
Background color is what shows through when you don't have any content.
Upvotes: 0