1.方法一:当屏幕变化时会自动调用此方法
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation==UIInterfaceOrientationPortrait) {
}else if (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){
}else if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft){
}else if (interfaceOrientation==UIInterfaceOrientationLandscapeRight){
}
}
if ([UIScreen mainScreen].bounds.size.width>[UIScreen mainScreen].bounds.size.height) {
//横屏
}else{
//竖屏
}