1

I have written code for the side bar. It displays properly on the simulator, but not on the actual device. I could not able to figure that out? I defined my storyboard with landscape layout. Device is running 7.0 but simulator 8.1.

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
     [sideBarLeft insertMenuButtonOnView:[UIApplication sharedApplication].delegate.window atPosition:CGPointMake(self.view.frame.size.width-980,0) atSite:@"Left"];

}

Simulator:

enter image description here Device

enter image description here

casillas
  • 16,351
  • 19
  • 115
  • 215
  • what version of iOS are you running on, and where in the view lifecycle are you calling `insertMenuButtonOnView:`? – Nick Dec 17 '14 at 19:53

1 Answers1

3

In earlier versions of iOS (7 and below), UIWindow coordinate systems do not rotate. When attempting to add a subview to a window, it was common practice to apply a transform based on current device orientation. (similar to the accepted answer here: iPhone - UIWindow rotating depending on current orientation?)

For iOS 8 and above, UIWindow coordinate systems DO rotate, so applying this transform is no longer necessary. If your app targets ONLY iOS 8+ you should not have to change your code, if you are targeting anything older than that, you'll need to put in handling similar to the answer I linked above.

Community
  • 1
  • 1
Nick
  • 2,361
  • 16
  • 27