iOS status bar api implement

This commit is contained in:
王劲鹏
2020-01-14 11:00:22 +08:00
committed by osborn
parent c63454869c
commit 73c06373ad
11 changed files with 184 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
8BCADA7C23CD5B65005EEF96 /* NavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BCADA7B23CD5B64005EEF96 /* NavigationController.m */; };
A1E221FB2DCA40D85C4D9520 /* libPods-ExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F233ACD236542275AED3DE0 /* libPods-ExampleTests.a */; };
CC537F4B9F59400BA5B4FF8F /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DEE8411A69609CC9C86063CC /* libPods-Example.a */; };
D751D4B065D8D4FA6594B5EE /* DemoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = D751D19E97EF4EDD7588FEBE /* DemoVC.m */; };
@@ -46,6 +47,8 @@
3D75F592D76A665674B31A66 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
4F233ACD236542275AED3DE0 /* libPods-ExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
8231E841CCAF382F85C9F576 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
8BCADA7A23CD5B5F005EEF96 /* NavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NavigationController.h; sourceTree = "<group>"; };
8BCADA7B23CD5B64005EEF96 /* NavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavigationController.m; sourceTree = "<group>"; };
B93423722F2E06DC238CDD18 /* Pods-ExampleUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests.release.xcconfig"; sourceTree = "<group>"; };
B93D4DB00FD244178B7CE7C4 /* Pods-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests.release.xcconfig"; sourceTree = "<group>"; };
D751D18AD6496F4A9BE1AB45 /* QRScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRScanViewController.h; sourceTree = "<group>"; };
@@ -157,6 +160,8 @@
E2334AEF22E9D2060098A085 /* AppDelegate.m */,
E2334AF122E9D2060098A085 /* ViewController.h */,
E2334AF222E9D2060098A085 /* ViewController.m */,
8BCADA7A23CD5B5F005EEF96 /* NavigationController.h */,
8BCADA7B23CD5B64005EEF96 /* NavigationController.m */,
E2334AF422E9D2060098A085 /* Main.storyboard */,
E2334AF722E9D2070098A085 /* Assets.xcassets */,
E2334AFC22E9D2070098A085 /* Info.plist */,
@@ -436,6 +441,7 @@
D751D4B065D8D4FA6594B5EE /* DemoVC.m in Sources */,
D751D4FCC0A2322211DE3D55 /* QRScanViewController.m in Sources */,
D751DDB012BAF476A252CD93 /* DemoLibrary.m in Sources */,
8BCADA7C23CD5B65005EEF96 /* NavigationController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -7,11 +7,12 @@
//
#import "AppDelegate.h"
#import "NavigationController.h"
#import "ViewController.h"
@interface AppDelegate ()
@property(nonatomic, strong) UIViewController *rootVC;
@property(nonatomic, strong) UINavigationController *navigationController;
@property(nonatomic, strong) NavigationController *navigationController;
@end
@implementation AppDelegate
@@ -22,9 +23,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.rootVC = [[ViewController alloc] init];
self.window.rootViewController = self.rootVC;
self.navigationController = [[UINavigationController
self.navigationController = [[NavigationController
alloc] initWithRootViewController:self.rootVC];
self.window.rootViewController = self.navigationController;
[self.window addSubview:self.navigationController.view];
[self.window makeKeyAndVisible];
return YES;

View File

@@ -50,5 +50,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,28 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// NavigationController.h
// Doric
//
// Created by jingpeng.wang on 2020/1/14.
//
#import <UIKit/UIKit.h>
@interface NavigationController : UINavigationController
@end

View File

@@ -0,0 +1,33 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// NavigationController.m
// Doric
//
// Created by jingpeng.wang on 2020/1/14.
//
#import "NavigationController.h"
@implementation NavigationController
- (UIStatusBarStyle)preferredStatusBarStyle {
return [self.topViewController preferredStatusBarStyle];
}
- (BOOL)prefersStatusBarHidden {
return [self.topViewController prefersStatusBarHidden];
}
@end

View File

@@ -6,9 +6,9 @@
// Copyright © 2019 pengfei.zhou. All rights reserved.
//
#import "ViewController.h"
#import <DoricCore/Doric.h>
#import "DemoVC.h"
#import "ViewController.h"
#import "QRScanViewController.h"
#import "DemoLibrary.h"