What I'm trying to do is create a view controller, and have its view animate in from the right. The main view controller has a view called viewContainer that will house this view. The weird thing is that this works works perfectly in the simulator and on an ipod 4g, but does not work on the iPhone5 (both running ios6).
On the ipod 4g, the new view correctly animates in from the right. On the iPhone5 however, the view appears immediately at (0,0). What could be causing this?
self.catViewController = [[CatViewController alloc] initWithNibName:@"CatViewController" bundle:nil];
[self.catViewController willMoveToParentViewController:nil];
[self addChildViewController:self.catViewController];
self.currentViewController = self.catViewController;
[self showNextViewController];
- (void) showNextViewController
{
NSLog(@"should be at x: %f", self.viewContainer.bounds.size.width); //This correctly logs 320 as the starting x position of the new view
//set the new view's position off screen to the right
self.currentViewController.view.frame = CGRectMake(self.viewContainer.bounds.size.width, self.viewContainer.bounds.origin.y, self.currentViewController.view.frame.size.width, self.currentViewController.view.frame.size.height);
[self.viewContainer addSubview:self.currentViewController.view];
//inexplicably to me, this logs 0.0 instead of 320 on the iphone5:
DLog(@"actual starting x position: %f", self.currentViewController.view.frame.origin.x);
[UIView animateWithDuration:kDefaultAnimationTime
delay:0.0f
options:UIViewAnimationOptionCurveEaseInOut
animations:^{self.currentViewController.view.frame = self.viewContainer.bounds;}
completion:^(BOOL finished){
//
}];
}