UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown, 界面取向未知iphone
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, 正常的肖像模式 就是向上ide
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, 向下视频
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, 向右ip
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft 向左it
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationio
{程序
返回YES支持旋转 NO不支持旋转方法
经过获取UIDevice的userInterfaceIdiom属性,能够检测到当前程序是运行在iphone或者是ipad上im
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {ipad
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
这个方法是发生在翻转开始以前。通常用来禁用某些控件或者中止某些正在进行的活动,好比中止视频播放
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
这个方法发生在翻转的过程当中,通常用来定制翻转后各个控件的位置、大小等。能够用另外两个方法来代替:willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: 和 willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
这个方法发生在整个翻转完成以后。通常用来从新启用某些控件或者继续翻转以前被暂停的活动,好比继续视频播放。