Change to order of views in Interface Builder leads to a mess?
I am new to iOS programming and I am going through David Mark, Jeff LaMarche's iPhone development book. In one of the apps, I had used the code from the book and everything was working. The app had two UIViews (one was a landscape UIView and the other a portrait UIView). Just to see what happens, I moved the portrait UIView to be the second in the main window of Interface builder. Then I executed the app. The landscape view now came up immediately on execution instead of the portrait UIVIew. I went back to the app and checked that the default "view" outlet was still mapped to the Portrait UIView which was now appearing as the second view in the main window.
Why did this happen? I thought that the default view outlet always points to the first UIView that is shown.
Does the order of appea开发者_运维技巧rance in the main window determine which UIView gets shown first on execution?
Thanks
Paul
I'm not really sure what you mean, but I can tell you, is that you don't need separate views for portrait or landscape. You just use the autoresizingMask
of the subviews to let them dynamically layout on your view.
The thing you say that the default view outlet always points to the first UIView
is wrong. The default view outlet, is defined in the 'connections' of that XIB's file's owner. There you have a view connection you can set to the appropriate UIView
.
If you need extra info, just reply ;)
精彩评论