简体   繁体   中英

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM