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
這個方法發生在整個翻轉完成以後。通常用來從新啓用某些控件或者繼續翻轉以前被暫停的活動,好比繼續視頻播放。