iOS Question ShouldAutoRotate not work in iOS 16

Filippo

Expert
Licensed User
Longtime User
Hi,

the ShouldAutoRotate function no longer works in iOS 16, how to solve the problem?
I found something here, but can not implement myself.

B4X:
Sub Main_ShouldAutoRotate As Boolean
    Log("Main_ShouldAutoRotate")
    If IsSetOrientation Then
        If DeviceOrientation = "Portrait" And OrientationModus = "Landscape" Then
            Return False
        else If DeviceOrientation <> "Portrait" And OrientationModus = "Portrait" Then
            Return False
        Else
            Return True
        End If
    Else
        Return False
    End If
End Sub

B4X:
#if OBJC
@end
@interface UINavigationController (B4IResize)

@end
@implementation UINavigationController (B4IResize)
- (BOOL)shouldAutorotate
{
  return [(NSNumber*)[B4IObjectWrapper raiseEvent:self :@"_shouldautorotate" :nil] boolValue];
}

#End If

#End Region
 

Filippo

Expert
Licensed User
Longtime User
I've tried several things but they didn't work on iOS 16.
There is a new API that allows you to explicitly rotate the screen. What exactly are you trying to do?
I have 2 layouts in my app, one for horizontal and one for vertical alignment.
Via the App-Setting the user can choose between the 2 alignments.
Therefore, the alignment should not change automatically. This has also worked well until iOS 15.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I've tried several things and none worked. No solution for now.
Hi Erel,

Apple writes here that from iOS-16 you can use the new ViewController "setNeedsUpdateOfSupportedInterface", but doesn't write how and doesn't give an example.
For some of my applications this feature is absolutely necessary, without it the functionality of the application is otherwise very limited.

 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I'm familiar with this and did try it. Unfortunately it didn't work...
Thanks Erel!
Then I can only hope that Apple fixes the bug, because I think that many other programmers have the same problem.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…