//
//  CustomNavViewController.m
//  hengPingVC
//
//  Created by MacBook Dq01 on 16/4/28.
//  Copyright © 2016年 MacBook Dq01. All rights reserved.
//

#import "CustomNavViewController.h"

@interface CustomNavViewController ()

//@property (nonatomic, strong) hhhhhViewController *hVC;

//@property (nonatomic) UIInterfaceOrientation orietation;

@end

@implementation CustomNavViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.view.center = CGPointMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2);
    CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI/2);
    [self.view setTransform:transform];
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.    
    
}
-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
    
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_9_0
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}

//- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
//    [super presentViewController:viewControllerToPresent animated:flag completion:completion];
//    
//}

//- (BOOL)shouldAutorotate {
//    [super shouldAutorotate];
//    return NO;
//}

//- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
//    [super preferredInterfaceOrientationForPresentation];
//    
//    return self.orietation;
//}

//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
//    [super shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
//    return (toInterfaceOrientation != self.orietation);
//}

//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
//{
//    return toInterfaceOrientation != UIDeviceOrientationPortraitUpsideDown;
//}
//
//- (BOOL)shouldAutorotate
//{
//    if ([self.hVC isKindOfClass:[hhhhhViewController class]]) { // 如果是这个 vc 则支持自动旋转
//        return YES;
//    }
//    return NO;
//}
//
//- (NSUInteger)supportedInterfaceOrientations
//{
//    return UIInterfaceOrientationMaskAllButUpsideDown;
//}
//



///////////////////
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
