As a way of switching between views, I'm creating a top-level root view object and then adding/removing child views to/from that. The child views are those created with the layout editor and loaded using ui.load_view().
What I'm finding is that if I load a view and present it, everything works fine. The view fills the screen on my iPhone 4s. If, however, I create the root view object, then add the loaded view to that and present the root view, it does not fill the screen.
I've experimented with setting the flex attribute on the root view but this didn't seem to help (I tried 'WH' for example).
Here's some sample code which illustrates the issue.
import ui
v = ui.load_view('test')
mode = 0
if mode == 0:
v.present()
else:
rootView = ui.View()
rootView.add_subview(v)
rootView.present()
The above code is in test.py and there's a simple test.pyui to go along with it. In the above, I'm manually toggling the mode variable value to test things. If mode == 0, it works correctly and the UI fills the screen. If mode == 1 it does not fill the screen.
Any suggestions?