' Returns 1 = Portrait, 2 = PortraitUpsideDown, 3 = LandscapeLeft, 4 = LandscapeRight or -1 = Error
Private Sub getOrientation() As Int
Dim no As NativeObject
Try
no = no.Initialize("UIDevice").RunMethod("currentDevice", Null)
Dim orientation As Int = no.RunMethod("orientation", Null).AsNumber
Return orientation
Catch
Log("Failed to get Device Orientation from UIDevice.currentDevice().")
End Try
Return -1
End Sub
Public Sub isLandscape() As Boolean
Dim intOrientation As Int
' 1 = Portrait, 2 = PortraitUpsideDown, 3 = LandscapeLeft, 4 = LandscapeRight, -1 = Error
intOrientation = getOrientation
Return intOrientation = 3 Or intOrientation = 4
End Sub
Public Sub isPortrait() As Boolean
Dim orientation As Int
' 1 = Portrait, 2 = PortraitUpsideDown, 3 = LandscapeLeft, 4 = LandscapeRight, -1 = Error
' Return true in case of error
orientation = getOrientation
Return orientation = 1 Or orientation = 2 Or orientation = -1
End Sub