Commit 833c9dee cgx

状态栏处理(导航栏控制和页面单独控制)

1 个父辈 e2200162
......@@ -911,6 +911,7 @@
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
......@@ -956,9 +957,10 @@
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠";
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
......@@ -1062,9 +1064,10 @@
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Beta";
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
......
......@@ -12,11 +12,13 @@
- NaviStyleDefault: 默认
- NaviStyleLight : Light
- NaviStyleDark : Dark
- NaviStyleUndef:未定义
*/
typedef NS_ENUM(NSUInteger, NaviStyle) {
NaviStyleDefault,
NaviStyleLight,
NaviStyleDark,
NaviStyleUndef
};
#import <Foundation/Foundation.h>
......
......@@ -7,7 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "NaviBarHandlerProtocol.h"
@interface UIViewController (Swizzling) <NaviBarHandlerProtocol>
@end
......@@ -56,8 +56,10 @@
[BaseNaviController setNavigationBarStyle:[self navigationBarStyle] vc:self];
} else {
// 默认风格
if (self.navigationController) {
[BaseNaviController setNavigationBarStyle:NaviStyleDefault vc:self];
}
}
#pragma mark - 重返系统事件
[self swiz_viewWillAppear:animated];
......
......@@ -31,5 +31,7 @@
<array>
<string>audio</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
</dict>
</plist>
......@@ -20,6 +20,11 @@
self.view = self.leadView;
}
#pragma mark - 设置状态栏文字颜色
- (UIStatusBarStyle)preferredStatusBarStyle {
return [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
}
- (LeadView *)leadView {
if (!_leadView) {
_leadView = [[LeadView alloc] initWithFrame:self.view.bounds];
......
......@@ -22,13 +22,12 @@
self.window.backgroundColor = DSWhite;
[self.window makeKeyAndVisible];
UIStoryboard * mainStoryBoard =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
self.window.rootViewController = [mainStoryBoard instantiateViewControllerWithIdentifier:@"mainSB"];
// self.window.rootViewController = [mainStoryBoard instantiateViewControllerWithIdentifier:@"mainSB"];
// BaseNaviController *navi = [[BaseNaviController alloc] initWithRootViewController:[[PrivacyViewController alloc] init]];
// self.window.rootViewController = navi;
BaseNaviController *navi = [[BaseNaviController alloc] initWithRootViewController:[[PrivacyViewController alloc] init]];
self.window.rootViewController = navi;
[self initWeChat];
[self initYTKNetwork];
return YES;
}
......@@ -48,10 +47,6 @@
// }];
}
- (void)initYTKNetwork {
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
return [WXApi handleOpenURL:url delegate:self];
}
......
......@@ -38,10 +38,12 @@
titleColor = ColorFromHex(0x333333);
bgColor = DSWhite;
barTintColor = DSWhite;
// naviBar.barStyle = UIBarStyleDefault;
} else if (style == NaviStyleDark) {
titleColor = DSWhite;
bgColor = DarkColor;
barTintColor = DarkColor;
// naviBar.barStyle = UIBarStyleBlack;
}
// 设置导航栏title颜色、导航栏背景色、隐藏分割线
......@@ -71,4 +73,31 @@
}
}
/*
状态栏风格设置:
1、如果UIViewController由导航控制器管理,则状态栏风格由导航栏preferredStatusBarStyle决定;
2、如果UIViewController没有由导航控制器管理,则需要单独在控制器种进行设置
//#pragma mark - 设置状态栏文字颜色
//- (UIStatusBarStyle)preferredStatusBarStyle {
// return UIStatusBarStyleLightContent;
//}
//#pragma mark - 隐藏状态栏
//- (BOOL)prefersStatusBarHidden {
// return YES;
//}
*/
- (UIStatusBarStyle)preferredStatusBarStyle {
// 白天和黑夜2种模式
UIStatusBarStyle barStyle = [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
// 默认风格模式(控制器重写navigationBarStyle方法)
UIViewController* topVC = self.topViewController;
if ([topVC respondsToSelector:@selector(navigationBarStyle)]) {
NaviStyle sty = (NaviStyle)[topVC performSelector:@selector(navigationBarStyle)];
if (sty == NaviStyleDefault) { barStyle = UIStatusBarStyleLightContent; }
}
return barStyle;
}
@end
......@@ -63,6 +63,21 @@
return NO;
}
#pragma mark - H5页面导航栏为默认模式
- (NaviStyle)navigationBarStyle {
return self.isDetail ? NaviStyleDefault : NaviStyleUndef;
}
#pragma mark - 设置状态栏文字颜色
- (UIStatusBarStyle)preferredStatusBarStyle {
if (self.isDetail) {
// 导航栏显示不会执行以下代码
return UIStatusBarStyleLightContent;
} else {
return [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
}
}
- (void)showPrivacyView {
self.policyView = [[PrivacyView alloc] init];
[self.view addSubview:self.policyView];
......
......@@ -23,7 +23,7 @@
self.tmpDatas = @[@"注册登录信息", @"意见反馈", @"系统设置", @"邀请好友", @"关于我们", @"前往小程序", @"关注公众号", @"添加客服微信", @"失眠的认知行为疗法", @"模拟Apple登录"];
}
#pragma mark - 导航栏日间、黑夜模式
#pragma mark - 导航栏默认模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!