Ios6 不响应WillAnimateRotationInterfaceOrientation:(UIInterfaceOrientation)到InterfaceOrientation持续时间:(NSTimeInterval)持续时间
我有密码Ios6 不响应WillAnimateRotationInterfaceOrientation:(UIInterfaceOrientation)到InterfaceOrientation持续时间:(NSTimeInterval)持续时间,ios6,Ios6,我有密码 -(BOOL) shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAllButUpsideDown; } - (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientati
-(BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willAnimateRotationToInterfaceOrientation: toInterfaceOrientation duration: duration];
deviceOrientation = toInterfaceOrientation;
if(deviceOrientation == UIInterfaceOrientationPortrait)
{
curPageSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-STATUS_BAR_HEIGHT);
}
else if(deviceOrientation == UIInterfaceOrientationLandscapeLeft || deviceOrientation == UIInterfaceOrientationLandscapeRight)
{
curPageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width-STATUS_BAR_HEIGHT);
}
[self correctViews:curPageSize];
}
此方法在ModalViewController中定义。。。
当我旋转设备时,程序不会响应WillAnimateRotationInterfaceOrientation:(UIInterfaceOrientation)到InterfaceOrientation持续时间:(NSTimeInterval)持续时间
我该怎么办 试着让你的代码适应这样的情况……我已经在许多应用程序中成功地使用了这种方法。快乐编码
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
//Landscape
self.ViewL.frame = CGRectMake(0, 0, 1024, 728);
self.ViewL.hidden=NO;
self.ViewP.hidden=YES;
}
else
{
//Portrait
self.ViewP.frame = CGRectMake(0, 0, 768, 955);
self.ViewP.hidden=NO;
self.ViewL.hidden=YES;
}
}
尝试将你的代码改编成这样的东西……我已经在许多应用程序中成功地使用了这种方法。快乐编码
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
//Landscape
self.ViewL.frame = CGRectMake(0, 0, 1024, 728);
self.ViewL.hidden=NO;
self.ViewP.hidden=YES;
}
else
{
//Portrait
self.ViewP.frame = CGRectMake(0, 0, 768, 955);
self.ViewP.hidden=NO;
self.ViewL.hidden=YES;
}
}