Why is my toolbar not visible when in landscape mode?

Posted by mr-sk on Stack Overflow See other posts from Stack Overflow or by mr-sk
Published on 2009-04-21T02:04:45Z Indexed on 2010/03/18 12:01 UTC
Read the original article Hit count: 532

Filed under:
|

My aim was to get the application functioning in both landscape and portrait mode, and all I could figure out to do it was this code below. The app was working fine in portrait, but when switched to landscape, the text wouldn't expand (to the right) to fill up the additional space. I made sure my springs/struts where set, and that the parents had "allowResizing" selected in IB.

Here's what I've done instead:

- (void) willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration: 
(NSTimeInterval)duration {
  UIInterfaceOrientation toInterfaceOrientation = self.interfaceOrientation;

  if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
    self.myView.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
  }
  else {
    self.myView.frame = CGRectMake(0.0, 0.0, 480.0, 256.0);
  }
}

Note that it looks just fine in portrait mode (toolbar appears):

Portrait

But the toolbar is gone in landscape mode:

Landscape

Any ideas?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about landscape