-(void)viewWillAppear:(BOOL)animated{
[self didReceiveMemoryWarning];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.view=[[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.view.backgroundColor=[UIColor redColor];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
// Do any additional setup after loading the view.
}
-(void)detectOrientation
{
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft||[[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) {
NSLog(@"横屏");
}else
{
NSLog(@"竖屏");
}
}