iOS Question Question about Display orientation

Filippo

Expert
Licensed User
Hi,

I want the iPhone from 5 inches (iPhone 6+) the same orientation as an iPad, how can I make it?
With this code does not go. :(

B4X:
    If IsPadDevice Then
        #iPadOrientations: LandscapeLeft, LandscapeRight
        #iPhoneOrientations: LandscapeLeft, LandscapeRight
        Page1.RootPanel.LoadLayout("frmMainIpad")
    Else
        #iPhoneOrientations: Portrait
        Page1.RootPanel.LoadLayout("frmMainIphone")
    End If
B4X:
Public Sub IsPadDevice As Boolean
    If Main.App.iPadDevice Or GetDeviceLayoutValues.DeviceApproximateScreenSize > 5 Then
        Return True
    Else
        Return False
    End If
End Sub
 

Filippo

Expert
Licensed User
Upvote 0

ilan

Expert
Licensed User
you could set the attributes to Landscape only and when you start your app you could check if DeviceApproximateScreenSize < 5 and change the orientation programmatically

B4X:
Sub SetOrientation(landscape As Boolean)
   Dim no As NativeObject
   Dim value As Int
   If landscape Then value = 4 Else value = 1
   no.Initialize("UIDevice").RunMethod("currentDevice", Null).SetField("orientation", value)
End Sub

(code found here: https://www.b4x.com/android/forum/t...-view-in-portrait-only-app.51391/#post-321845)
 
Upvote 0

Filippo

Expert
Licensed User
Thank you Ilan! :)
I had searched, before my request, for this info, unfortunately without success.
 
Upvote 0
Top