Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sandman4sure

macrumors newbie
Original poster
Oct 23, 2007
14
0
Hello,

I have problems with rotating a view.
My app consists of 2 views (like the weather app) and one is always in landscape mode. So I have added the following code:

PHP:
MainViewController *viewController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil];
    self.mainViewController = viewController;
    mainViewController.rvc = self;

    // rotate view to landscape
    viewController.view.transform = CGAffineTransformMakeRotation( M_PI /2);
    viewController.view.center = self.view.center;

    [viewController release];
    
    infoButton.transform = CGAffineTransformMakeRotation( M_PI /2);
    
    CGPoint point = CGPointMake(35, 445);
    infoButton.center = point;
    
    [self.view insertSubview:mainViewController.view belowSubview:infoButton];

This almost always works correctly, but once in a while it won't rotate and I will get the view like in the second screenshot. (like once in 50 times or so)

When I close the app and open, it is correct again.

In the Interface Builder I have resized the window, so it is landscape and not portrait. Otherwise I couldn't add the elements in the right orientation.

Anybody know what to do here?
 

Attachments

  • 40d1222106517-rotating-sometimes-doesnt-work-img_0012.jpg
    40d1222106517-rotating-sometimes-doesnt-work-img_0012.jpg
    42.4 KB · Views: 56
  • 41d1222106527-rotating-sometimes-doesnt-work-img_0010.jpg
    41d1222106527-rotating-sometimes-doesnt-work-img_0010.jpg
    64.5 KB · Views: 46
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.