Skip to content

Commit b9e6d71

Browse files
authored
Merge pull request didi#92 from zhwei8090/master
fix:在iOS9.0系统中直接不显示状态栏的问题,但是在开启cpu监听等状态时,还是不显示状态栏,暂未找到解决版本
2 parents 422894b + a209d8b commit b9e6d71

3 files changed

Lines changed: 64 additions & 3 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// DoraemonStatusBarViewController.h
3+
// AFNetworking
4+
//
5+
// Created by 张伟 on 2019/2/22.
6+
//
7+
8+
#import <UIKit/UIKit.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@interface DoraemonStatusBarViewController : UIViewController
13+
14+
@end
15+
16+
NS_ASSUME_NONNULL_END
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// DoraemonStatusBarViewController.m
3+
// AFNetworking
4+
//
5+
// Created by 张伟 on 2019/2/22.
6+
//
7+
8+
#import "DoraemonStatusBarViewController.h"
9+
10+
@interface DoraemonStatusBarViewController ()
11+
12+
@end
13+
14+
@implementation DoraemonStatusBarViewController
15+
16+
- (void)viewDidLoad {
17+
[super viewDidLoad];
18+
// Do any additional setup after loading the view.
19+
}
20+
- (BOOL)prefersStatusBarHidden
21+
{
22+
return NO;
23+
}
24+
- (UIStatusBarStyle)preferredStatusBarStyle
25+
{
26+
return UIStatusBarStyleDefault;
27+
}
28+
/*
29+
#pragma mark - Navigation
30+
31+
// In a storyboard-based application, you will often want to do a little preparation before navigation
32+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
33+
// Get the new view controller using [segue destinationViewController].
34+
// Pass the selected object to the new view controller.
35+
}
36+
*/
37+
38+
@end

iOS/DoraemonKit/Src/Core/Entry/DoraemonEntryView.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#import "UIImage+Doraemon.h"
1414
#import "DoraemonDefine.h"
1515
#import "DoraemonHomeWindow.h"
16-
16+
#import "DoraemonStatusBarViewController.h"
1717
@interface DoraemonEntryView()
1818

1919
@property (nonatomic, assign) BOOL isOpen;
@@ -32,8 +32,15 @@ - (instancetype)init{
3232

3333
self.backgroundColor = [UIColor clearColor];
3434
self.windowLevel = UIWindowLevelStatusBar + 100.f;
35-
if (!self.rootViewController) {
36-
self.rootViewController = [[UIViewController alloc] init];
35+
NSString *version= [UIDevice currentDevice].systemVersion;
36+
if(version.doubleValue >=10.0) {
37+
if (!self.rootViewController) {
38+
self.rootViewController = [[UIViewController alloc] init];
39+
}
40+
}else{
41+
if (!self.rootViewController) {
42+
self.rootViewController = [[DoraemonStatusBarViewController alloc] init];
43+
}
3744
}
3845

3946
UIButton *entryBtn = [[UIButton alloc] initWithFrame:self.bounds];

0 commit comments

Comments
 (0)