landscape to portrait orientation viewController issue in Xcode 11(iOS Sdk 13.0)

Hi,


I am launching a game in landscape mode in xcode11(iOS SDK13.0) by using objective -c. The problem is what i had faced is: changing from landscape to potrait orientation ,still the view controller is appearing in landscape only but not potrait.


Could you please share your comments ASAP.


Thank you ,

Replies

Have you set the Device Orientation to include landscape (in IB, select the projecvt name on the left, then select Target. Look at deployment info).


In the VCs add the following :

    override open var supportedInterfaceOrientations : UIInterfaceOrientationMask     {
        return .all
    }

Hi Claude,


Thanks for the info but it is not working for me. Please find my comments as below for your question


yes. I have set the device orientation to include landscape in deployment info . Actually the problem in Landscape mode of the game we have some button actions at bottom bar. Clicked on any of the button, that particular view controller is appearing in landscape mode but expected is potrait mode. This issue we are facing only after upgrading the xcode11 with SDK 13.0.


Could you please share your comments on this above issue


Thank you,

Clicked on any of the button, that particular view controller is appearing in landscape mode but expected is potrait mode.


Could you show the code that makes you expect the VC will open in portrait ?

BTW, that may seem bizarre to the user who is holding the device in landscape ?

Previously we are using the below code for potrait in viewWillAppear method in particular controller


[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];


Now in iOS 13.0 the above line of code is not working. Is there any alternative for this line.


Thanks

Have you checked that this line of code

     [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];

is called ?


With iOS13, viewWillAppear is not called as it was before.

If the ViewController transition is set to Automatic, viewWillAppear is not called when returning from another view.


So, try to change in IB (Attributes Inspector) the presentation to 'full screen'.


And tell us if it works.

Actually, we are using xib files, so unable to change in IB the presentation to full screen. Any alternative solution for this?


Thanks

unable to change in IB the presentation to full screen


On which object do you try ?

That should be on the view controller itself, via its property inspector.


You did not answer my question:

Have you checked that this line of code

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];

is called ?

I could not able to apply the full screen to the viewController. As it is not available in xib.


So I try to apply the freeform for the view.


The Method [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; is getting called in viewWillAppear. Due to depreciated in ios13 this method is not working. Earlier we requested for this method for alternate solution.


Thanks

Could you clarify:

I could not able to apply the full screen to the viewController. As it is not available in xib.


What is the xib ? Is it a View ?

If so, you will have an associated ViewController somewhere that loads this view. Is that the case ?


You should apply the fullScreen to this viewController.