Orientation

I have an app with a few views. All but one of the views manage a change in orientation no problem but for one of the views it makes no sense for it to be viewed in Landscape.

Is there a way of locking down that one view to Portrait?

Add another iOScreen to the project, give it other orientation settings, use it like the example on the bottom of the web site http://developer.xojo.com/userguide/ios-screens

note that iPhoneX does NOT support Portrait Upside down, and the “safe area” adjusts between Landscape Left and Landscape Right

Still a bit confused with that process.

  • I created a new Screen call ReportScreen which has a default View of ReportView with only Portrait orientation
  • I have a ReportView (which is the view I want in Portrait)

Where do I put this code? I tried the Open Event of ReportView but the simulator just freezes

Dim s As New ReportScreen
App.CurrentScreen.Content = s.Content

Drop the .Content on the s. I don’t have that on any of my App.CurrentScreen.Content Statements

Just checking where that code actually goes??

Hi Steve,

Dropping the .content produces the following error

Type mismatch error. Expected interface iOSScreenContent, but got class SelfieScreen
App.CurrentScreen.Content = s

How are you defining SelfieScreen?

Sorry about that was jumping between 2 examples

ReportScreen is an ios screen with ReportView as its default content

Dim s As New ReportScreen
App.CurrentScreen.Content = s

Does your app just exit or stay on the current screen when you do this? If so you are likely getting nil object exception on your ReportScreen when its trying to construct it. If you do not have a UnhandledException event on your App class or the Screen your loading from then you won’t see this occurring.

Yes it just freezes on loading and I have to quit the simulator.
Do you have a screen/view example you could post or send, I seem to be going around in circles on this one?
Thanks

My experience has been in this situation that there is something in the construction of the new View. In your case the Reportview that causes an error. Any easy check is in the Debugger put a checkpoint on the dimension of Dim s as New Reportscreen and walk through the construction.

The ReportView operates fine when used with the standard project default screens, it only freezes when I add the new screen with the restricted orientation.

As stated I would put a breakpoint on the dimension of the Reportview screen and have it walk through the constructor code. You should be able to see what it is that is holding it up.