open/demo_src/TCP_Client/MobileIMSDK4iDemo_tcp/MobileIMSDK4iDemo/NavigationController.m

72 lines
3.0 KiB
Mathematica
Raw Permalink Normal View History

2025-01-18 15:55:12 +08:00
#import "NavigationController.h"
// 16#000000 , 使hexValue0x000000
#define HexColor(hexValue) [UIColor colorWithRed:((float)(((hexValue) & 0xFF0000) >> 16))/255.0 green:((float)(((hexValue) & 0xFF00) >> 8))/255.0 blue:((float)((hexValue) & 0xFF))/255.0 alpha:1.0]
@implementation NavigationController
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationBar.translucent = NO;
//
self.navigationBar.barTintColor = HexColor(0xfafafa);
//
self.navigationBar.tintColor = HexColor(0xc6391e);
// self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:UI_DEFAULT_HILIGHT_COLOR};
//
[self.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:19]//20]
,NSForegroundColorAttributeName:HexColor(0x2c2f36)}];
// navigationBar 线@2x@3x@1x线
// UIImage线线
[self.navigationBar setShadowImage:[UIImage imageNamed:@"navigation_bar_shadow_image"]];
// iOS15https://www.jianshu.com/p/6dcf60b645ec
if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *barApp = [UINavigationBarAppearance new];
//
barApp.backgroundColor = HexColor(0xfafafa);
barApp.backgroundEffect = nil;//
// self.navigationBar.shadowImage 线
barApp.shadowImage = [UIImage imageNamed:@"navigation_bar_shadow_image"];
self.navigationBar.scrollEdgeAppearance = barApp;
self.navigationBar.standardAppearance = barApp;
}
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleDefault;//UIStatusBarStyleLightContent;
}
//- (void)viewDidLoad {
// [super viewDidLoad];
// [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
//
// UINavigationBar *bar = [UINavigationBar appearance];
// CGFloat rgb = 0.1;
// bar.barTintColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.9];
// bar.tintColor = [UIColor whiteColor];
// bar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
//}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count)
{
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
}
@end