My app is designed to handle rotation but when the app is in a specific mode (recording video in this case) I need to prevent the current view from rotating.
So what I need is basically:
but I suppose I need to do this using declares?
Maybe someone else already done this?
I don’t think you can prevent a view from rotating, even with declares. In my app, my iPhone version does not support rotation but my iPad version does. Most views just handle this automatically but I have a CameraView (used for taking photos) where I want the preview and toolbar buttons (for shutter, flash, etc) to rotate just like the native iOS Camera app. To do this, in the Resized event of the view I switch on and off various iOSLayoutConstraints to rotate the controls.
If iPad Then
Dim orientation as Orientations = GetOrientation
Dim landscape As Boolean = (orientation = Orientations.LandscapeLeft or orientation = Orientations.LandscapeRight)
Dim portraitBottom As iOSLayoutConstraint = Self.Constraint("PortraitBottom")
portraitBottom.Active = Not landscape
Dim landscapeBottom As iOSLayoutConstraint = Self.Constraint("LandscapeBottom")
landscapeBottom.Active = landscape
Dim height As iOSLayoutConstraint = Self.Constraint("Height")
height.Active = Not landscape
Dim left As iOSLayoutConstraint = Self.Constraint("Left")
left.Active = Not landscape
Dim top As iOSLayoutConstraint = Self.Constraint("Top")
top.Active = landscape
Dim width As iOSLayoutConstraint = Self.Constraint("Width")
width.Active = landscape
Jason, thanks a lot!
The solution was a bit to close for me to see it.
Edit: I was too happy too fast . Must think a bit more about this.