开发者

Rotate view in simulator doesn't work

开发者 https://www.devze.com 2023-03-11 08:30 出处:网络
In UIViewController implementation i overriden shouldAutorotateToInterfaceOrientation method and return YES (or TRUE). Also i overriden this method:

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....

0

精彩评论

暂无评论...
验证码 换一张
取 消