In UIViewController implementation i overriden shouldAutorotateToInterfaceOrientation method and return YES (or TRUE). Also i overriden this method:
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInte开发者_开发技巧rfaceOrientation == UIInterfaceOrientationLandscapeRight) {
image.frame = CGRectMake(448, 381, 128, 113);
progresView.frame = CGRectMake(448, 498, 130, 11);
activityIndicator.frame = CGRectMake(448, 514, 20, 20);
statusLabel.frame = CGRectMake(473, 534, 97, 18);
} else {
image.frame = CGRectMake(335, 643, 128, 113);
progresView.frame = CGRectMake(335, 760, 130, 11);
activityIndicator.frame = CGRectMake(335, 776, 20, 20);
statusLabel.frame = CGRectMake(360, 776, 97, 18);
}
}
But when i play application in simulator or device, rotate doesn't work. It shows only in portrait mode. What am I doing wrong? any ideas?
P.S. I Am using XCode 4.0.2 and application is for iPad
You mean in UIViewController... not UIView right? Those methods are in the controller not at the view level....
精彩评论