//不推荐使用
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
//推荐
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(change) name:UIDeviceOrientationDidChangeNotification object:nil];
}
- (void)change
{
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationMaskPortrait)
{
[self.cellBtn setHidden:NO];
[self.leftVC.view setFrame:CGRectMake(0, 64, 300, self.view.current_h-64-49)];
}
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)
{
[self.cellBtn setHidden:YES];
[self.leftVC.view setFrame:CGRectMake(0, 64, 400, self.view.current_h-64-49)];
{
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationMaskPortrait)
{
[self.cellBtn setHidden:NO];
[self.leftVC.view setFrame:CGRectMake(0, 64, 300, self.view.current_h-64-49)];
}
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)
{
[self.cellBtn setHidden:YES];
[self.leftVC.view setFrame:CGRectMake(0, 64, 400, self.view.current_h-64-49)];
}
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight)
{
[self.cellBtn setHidden:YES];
[self.leftVC.view setFrame:CGRectMake(0, 64, 400, self.view.current_h-64-49)];
{
[self.cellBtn setHidden:YES];
[self.leftVC.view setFrame:CGRectMake(0, 64, 400, self.view.current_h-64-49)];
}
}