1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// IBTUINavigationController.m
// IBTImagePicker
//
// Created by Xummer on 1/17/15.
// Copyright (c) 2015 Xummer. All rights reserved.
//
#import "IBTUINavigationController.h"
@interface IBTUINavigationController ()
@end
@implementation IBTUINavigationController
#pragma mark - Life Cycle
- (id)initWithRootViewController:(UIViewController *)rootViewController {
self = [super initWithRootViewController:rootViewController];
if (self) {
self.navigationBar.translucent = NO;
// iOS 7 手势返回
if (IBT_IOS7_OR_LATER) {
self.interactivePopGestureRecognizer.delegate = _bEnablePopGesture ? (id<UIGestureRecognizerDelegate>)self : nil;
}
self.bEnablePopGesture = YES;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Setter
- (void)setBEnablePopGesture:(BOOL)bEnablePopGesture {
_bEnablePopGesture = bEnablePopGesture;
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.interactivePopGestureRecognizer.enabled = _bEnablePopGesture;
}
}
#pragma mark - Route
// below iOS6 use this method
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
// Above iOS6 use these two methods
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
#pragma mark - iOS7 Status bar
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
- (BOOL)prefersStatusBarHidden {
return NO;
}
@end