In order to allow the parent view (map view) to rotate at will, the Child view looks for some solutions based on a fixed direction (vertical screen) display, and finally finds that iOS7 is actually very simple.
-(BOOL)shouldAutorotate{ if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft ||[[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight) { return NO; } else{ return YES; }}
In addition, some users use the following method in iOS6:
Static CGSize appScreenSize; static UIInterfaceOrientation lastOrientation; + (CGSize) screenSize {UIInterfaceOrientation orientation = [UIApplication sharedApplication]. mismatch; if (appScreenSize. width = 0 | lastOrientation! = Orientation) {appScreenSize = CGSizeMake (0, 0); CGSize screenSize = [[UIScreen mainScreen] bounds]. size; // If the status bar is removed, you only need to use applicationFrame. If (orientation = UIDeviceOrientationLandscapeLeft | orientation = UIDeviceOrientationLandscapeRight) {// landscape screen, the returned width should be the height given by the system. Note: For full-screen applications and non-full-screen applications, you must increase or decrease the height of the status bar. AppScreenSize. width = screenSize. height; appScreenSize. height = screenSize. width;} else {appScreenSize. width = screenSize. width; appScreenSize. height = screenSize. height;} lastOrientation = orientation;} return appScreenSize ;}