Stanley
Stanley

Reputation: 4486

The difference between a UIWindow and a UIView

After creating a blank xib file, it seems that we can either drag a UIWindow or UIView to cover the entire screen. My question is what are the practical differences between the two and in what circumstances that we should use one over the other?

Upvotes: 12

Views: 10688

Answers (2)

beryllium
beryllium

Reputation: 29767

Windows do not have any visible content themselves but provide a basic container for your application’s views. Views define a portion of a window that you want to fill with some content. Typically, there is only one window in an iOS application.

About Windows and Views

Upvotes: 23

benzado
benzado

Reputation: 84388

It's not an either/or kind of thing. Your app must have a UIWindow instance that is the container for the UIView instances you present.

An app can either load the UIWindow instance from a nib file, or it can create it programmatically. Look at some sample code to see how it is done.

Upvotes: 9

Related Questions