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.
UIWindowis a subclass ofUIView, which is why you’ll see thebackgroundColorproperty. I’m not exactly sure how iOS handles this internally, but I assume that your root view controller’sviewproperty is loaded into the window’s view to display content.