开发者

What is the different between using separate view and include all view in a xib

开发者 https://www.devze.com 2022-12-22 01:40 出处:网络
Maybe I clarify my question this way. I want the Window load a view. After I click the MainWindow.xib, I can drag and drop a View in it. The View can make relationship between itself and window. It lo

Maybe I clarify my question this way. I want the Window load a view. After I click the MainWindow.xib, I can drag and drop a View in it. The View can make relationship between itself and window. It loads successful. The second way is crea开发者_如何学Pythonte a new view Xib. What is different between these two ways? Thz


A view XIB is associated to a UIViewController. The advantage of decoupling the controller creation from its view loading (XIB view loading) is to avoid using some memory until the view is really displayed on the screen (displaying the view on the screen will trigger an access to the controller.view property that will lead to the load of the UIView from the XIB associated to this controller).

Let's take an extreme ex : you put all your views / controller in the mainWindow.XIB. The resulting effect will be that all your views will be instantiated at launch time, even if some views are never displayed in one run cycle. Side effect would be slower startup time and poor memory usage optimization.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号