Ios orientation orientation screen in portrait orientation

when you first record, a result like this

Application in the background and back, normal orientation

this is the code for ViewController:

DDYLoveAutoHallViewController *autoHallViewController = [[DDYLoveAutoHallViewController alloc] initWithEvent:room.currentEventID type:AHRoom_System];
[self presentViewController:autoHallViewController animated:YES completion:nil];

I don’t know why the project is old, it supports iOS5 before.

+4
source share
2 answers

Without understanding how you manage the layouts, it’s hard to give an exact reason, it caused you problems, but I can offer you a couple of small tips:

  • - (void) viewDidLayoutSubviews, . (, , , , , )

  • , , . iOS. ( )

+1

, , , , , iOS 5.x( ), , :

[1] iOS , .

a) - - . ( , , ). ( "iPhone " - )

b) - "ViewDidLoad" "applicationDidBecomeActive" ( , - - ..)

c) didChangeStatusBarOrientation. Window.frame.size, . , , . : - , "didChangeStatusBarOrientation" .

[2] Non-Code Solution: ( : )

a) , , /info.plist. 1 " ", "", . ( , , " ", , , .)

[3] :

a) iOS , iOS6 , - .

, , ( ipad , ... iOS 5.1.1 - )

-(void) OrientationAndScreenSizeHELPER : (NSString *)fromObject
{
    //from:

    // NSLog(@"%s:%d someObject=%@", __func__, __LINE__, someObject);


    CGRect appFrame = [[UIScreen mainScreen ]applicationFrame];//using frame so status bar is not part of calculations.

    appFrame = [[self.viewController view]frame];//using frame so status bar is not part of calculations.

    UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

    NSLog(@"orientation[%ld] at time[%@]    width[%ld] height[%ld]",
      (long)orientation,
      fromObject,
      (long int)appFrame.size.width,
      (long int)appFrame.size.height);

}

**Output:**
orientation[1] at time[ViewDidLoad Orientation]    width[768] height[1024]
orientation[1] at time[applicationDidBecomeActive]    width[768] height[1024]
orientation[3] at time[didChangeStatusBarOrientation]    width[1024] height[768]
0

Source: https://habr.com/ru/post/1666522/


All Articles