Question on auto-rotation in ui.view
I am writing a script for my iPhone using the ui module. I want the view to display in only the portrait orientation and not auto-rotate. I have been using the script in the "Getting Started" documentation to figure out how to do that. From the description of the present() method, I thought changing the last line in that script from "view.present('screen')" to either "view.present('portrait')" or "view.present('full_screen', 'portrait')" would work. Neither did the trick. Any suggestions on how to do this would be appreciated.
view.present(orientations=["portrait"])works for me. I remember that the
presentmethod is a bit strange with its arguments - if it gets an unexpected argument value, it silently ignores it (even with obvious errors like incorrect types). In this particular case you need to pass a list of valid orientations, not a single string. I don't remember if the explicit
orientationsparameter name is necessary, but even if it isn't, it's easier to understand this way.
Thank you! This solved the problem. The orientations parameter does appear to be necessary.