用通知观察屏幕的情况
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(rotate)
name:UIDeviceOrientationDidChangeNotification
object:nil
];
-(void)rotate{
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation;
if (interfaceOrientation == UIInterfaceOrientationPortrait ) {
//竖屏操作
}else if(direction == UIInterfaceOrientationLandscapeRight)
{
//横屏操作
}
}