在我的
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
方法,我有代码可以在应用程序随设备旋转时重新定位和调整滚动视图的大小。我用下面的代码来做:
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:0.5f];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
//landscape
[mT.buttonScroll setFrame:CGRectMake(0, 544, 1024, 160)];
}else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft){
//landscape
[mT.buttonScroll setFrame:CGRectMake(0, 544, 1024, 160)];
}else if (toInterfaceOrientation == UIInterfaceOrientationPortrait){
//portrait
[mT.buttonScroll setFrame:CGRectMake(0, 800, 768, 160)];
}else if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
//portrait
[mT.buttonScroll setFrame:CGRectMake(0, 800, 768, 160)];
}
}
一切都正确旋转,但是一旦我第二次旋转,滚动视图就变得完全不可触摸。无法滚动或触摸其中的任何按钮。然后,如果我旋转回上一个视图,触摸就会回来,依此类推。有谁知道它为什么这样做?