1

In my iPhone application(iOS 6-8) i support only portrait interface orientation, it has an additional component – photo viewer, where you can view photos in all orientations. Problem is if you view photos turn the phone into a landscape position and close the photo viewer, status bar remains horizontal (on the left or right side of the application)

To bring it back to the top, you need to either completely close the application through the Task Manager or again open component and rotate to portrait state.

Question: how to do that when you close the component status bar back to the starting position (portrait)?

I have a few ideas, but I'm sure there is a better solution

  1. Check if photo viewer disappear, bring orientation back using force

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait]; or [[UIDevice currentDevice] setValue: [NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"];

  1. Create a category for component and hardcode supported orientations like below

- (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; }

rowwingman
  • 5,589
  • 7
  • 33
  • 50
WMZ
  • 73
  • 8

0 Answers0