xcode13适配
This commit is contained in:
parent
cb537f1949
commit
6029a5eb67
|
|
@ -2291,6 +2291,8 @@
|
|||
C0B2F55D244D5577001079AA /* StoreNameView.h in Headers */ = {isa = PBXBuildFile; fileRef = C0B2F55B244D5577001079AA /* StoreNameView.h */; };
|
||||
C0B2F55E244D5577001079AA /* StoreNameView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B2F55C244D5577001079AA /* StoreNameView.m */; };
|
||||
C0B2F560244D568E001079AA /* StoreNameView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0B2F55F244D568E001079AA /* StoreNameView.xib */; };
|
||||
C0C4CCFF272CDF4A00574BE8 /* UIViewController+Navgation.m in Sources */ = {isa = PBXBuildFile; fileRef = C0C4CCFD272CDF4A00574BE8 /* UIViewController+Navgation.m */; };
|
||||
C0C4CD00272CDF4A00574BE8 /* UIViewController+Navgation.h in Headers */ = {isa = PBXBuildFile; fileRef = C0C4CCFE272CDF4A00574BE8 /* UIViewController+Navgation.h */; };
|
||||
C0D3A1282647ED8E008E6FD6 /* ELPCircleConsoleView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0D3A1262647ED8D008E6FD6 /* ELPCircleConsoleView.m */; };
|
||||
C0D3A1292647ED8E008E6FD6 /* ELPCircleConsoleView.h in Headers */ = {isa = PBXBuildFile; fileRef = C0D3A1272647ED8D008E6FD6 /* ELPCircleConsoleView.h */; };
|
||||
C0D3A12C2647ED99008E6FD6 /* UIView+Sizes.h in Headers */ = {isa = PBXBuildFile; fileRef = C0D3A12A2647ED99008E6FD6 /* UIView+Sizes.h */; };
|
||||
|
|
@ -5761,6 +5763,8 @@
|
|||
C0B2F55B244D5577001079AA /* StoreNameView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StoreNameView.h; sourceTree = "<group>"; };
|
||||
C0B2F55C244D5577001079AA /* StoreNameView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StoreNameView.m; sourceTree = "<group>"; };
|
||||
C0B2F55F244D568E001079AA /* StoreNameView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StoreNameView.xib; sourceTree = "<group>"; };
|
||||
C0C4CCFD272CDF4A00574BE8 /* UIViewController+Navgation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Navgation.m"; sourceTree = "<group>"; };
|
||||
C0C4CCFE272CDF4A00574BE8 /* UIViewController+Navgation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Navgation.h"; sourceTree = "<group>"; };
|
||||
C0D3A1262647ED8D008E6FD6 /* ELPCircleConsoleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELPCircleConsoleView.m; sourceTree = "<group>"; };
|
||||
C0D3A1272647ED8D008E6FD6 /* ELPCircleConsoleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELPCircleConsoleView.h; sourceTree = "<group>"; };
|
||||
C0D3A12A2647ED99008E6FD6 /* UIView+Sizes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Sizes.h"; sourceTree = "<group>"; };
|
||||
|
|
@ -10030,6 +10034,7 @@
|
|||
883E791A1D48ACFF0030E075 /* Utinitys */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C0C4CCFC272CDEDA00574BE8 /* Category */,
|
||||
C0837A54244FF5500034FEC5 /* EGOCache */,
|
||||
885BD30E1E260B3C00CDB65A /* shuomingshu.html */,
|
||||
887495541DAE1B2D00F8F4E2 /* IfishUtils */,
|
||||
|
|
@ -12284,8 +12289,6 @@
|
|||
C0837A54244FF5500034FEC5 /* EGOCache */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */,
|
||||
C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */,
|
||||
C0837A55244FF5500034FEC5 /* EGOCache.m */,
|
||||
C0837A56244FF5500034FEC5 /* EGOCache.h */,
|
||||
);
|
||||
|
|
@ -12312,6 +12315,17 @@
|
|||
name = petsStoreName;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C0C4CCFC272CDEDA00574BE8 /* Category */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C0C4CCFE272CDF4A00574BE8 /* UIViewController+Navgation.h */,
|
||||
C0C4CCFD272CDF4A00574BE8 /* UIViewController+Navgation.m */,
|
||||
C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */,
|
||||
C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */,
|
||||
);
|
||||
path = Category;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C0D3A11B2647EB9F008E6FD6 /* ZLRocker */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -13159,6 +13173,7 @@
|
|||
CBB0244123517947002900D5 /* MJExtensionConst.h in Headers */,
|
||||
CBB0243A23517947002900D5 /* NSObject+MJClass.h in Headers */,
|
||||
3D1C5144221A9EE10096AE43 /* MonitorBootmView.h in Headers */,
|
||||
C0C4CD00272CDF4A00574BE8 /* UIViewController+Navgation.h in Headers */,
|
||||
3D1C50D3221A9EE00096AE43 /* UIScrollView+SVInfiniteScrolling.h in Headers */,
|
||||
CBA61655228F9A6C00ED380D /* YYModel.h in Headers */,
|
||||
CB484DFE22B8C8C80075F050 /* cpu.h in Headers */,
|
||||
|
|
@ -14879,6 +14894,7 @@
|
|||
3D1C50A4221A9EDF0096AE43 /* ProgressImageView.m in Sources */,
|
||||
CB7D6AA022953BEB0014E5C7 /* YYDiskCache.m in Sources */,
|
||||
883E793E1D48ACFF0030E075 /* AFHttpTool.m in Sources */,
|
||||
C0C4CCFF272CDF4A00574BE8 /* UIViewController+Navgation.m in Sources */,
|
||||
3DD7AB5121E2F2FB0064856A /* mask.c in Sources */,
|
||||
883E787C1D48A5E50030E075 /* IfishMeViewController.m in Sources */,
|
||||
CBA61683228F9AB100ED380D /* MASConstraintMaker.m in Sources */,
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ if (kScreenSize.height>480) {
|
|||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:logVC];
|
||||
self.window.rootViewController=nav;
|
||||
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
|
||||
}else{
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ if (kScreenSize.height>480) {
|
|||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:registVC];
|
||||
self.window.rootViewController=nav;
|
||||
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// UIViewController+Navgation.h
|
||||
// E-Mobile7
|
||||
//
|
||||
// Created by ldg on 2018/4/13.
|
||||
// Copyright © 2018年 Weaver. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
|
||||
@interface UIViewController (Navgation)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置导航栏背景颜色
|
||||
*/
|
||||
- (void)setNavbgColorStr:(NSString *)colorStr;
|
||||
|
||||
/**
|
||||
* 设置导航栏背景图片
|
||||
*/
|
||||
- (void)setNavbgImage:(UIImage *)image;
|
||||
//获取
|
||||
-(UIImage*)getNaveImage;
|
||||
|
||||
- (void)setNavbgColor:(UIColor *)color;
|
||||
|
||||
/**
|
||||
* 设置导航栏文字颜色
|
||||
*/
|
||||
- (void)setNavTitleColor:(UIColor *)color;
|
||||
//字体和颜色
|
||||
|
||||
- (void)setNavTitleTextAttributes:(NSDictionary*)attribute;
|
||||
|
||||
//字体
|
||||
- (void)setNavTitleFont:(UIFont *)font;
|
||||
- (UINavigationBarAppearance *)getNavgationAppearanceWithNavgationController:(UINavigationBar *)bar API_AVAILABLE(ios(13.0));
|
||||
@end
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
|
||||
//
|
||||
// UIViewController+Navgation.m
|
||||
// E-Mobile7
|
||||
//
|
||||
// Created by ldg on 2018/4/13.
|
||||
// Copyright © 2018年 Weaver. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIViewController+Navgation.h"
|
||||
|
||||
|
||||
@implementation UIViewController (Navgation)
|
||||
|
||||
|
||||
+ (UIColor *)colorWithHexString:(NSString *)stringToConvert
|
||||
{
|
||||
if ([stringToConvert hasPrefix:@"#"])
|
||||
{
|
||||
stringToConvert = [stringToConvert substringFromIndex:1];
|
||||
}
|
||||
float alpha=1.0;
|
||||
if (stringToConvert.length>6&&![stringToConvert hasPrefix:@"0x"])//含有透明度
|
||||
{
|
||||
NSString*alphaString=[stringToConvert substringToIndex:2];
|
||||
NSScanner *alphaScanner = [NSScanner scannerWithString:alphaString];
|
||||
unsigned hex;
|
||||
|
||||
if (![alphaScanner scanHexInt:&hex])
|
||||
{
|
||||
alpha=1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *hexChar = [alphaString cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
int hexNumber;
|
||||
sscanf(hexChar, "%x", &hexNumber);
|
||||
|
||||
alpha=hexNumber/255.0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NSScanner *scanner = [NSScanner scannerWithString:stringToConvert];
|
||||
unsigned hexNum;
|
||||
|
||||
if (![scanner scanHexInt:&hexNum])
|
||||
{
|
||||
return [UIColor clearColor];
|
||||
}
|
||||
|
||||
return [UIColor \
|
||||
colorWithRed:((float)((hexNum & 0xFF0000) >> 16))/255.0 \
|
||||
green:((float)((hexNum & 0xFF00) >> 8))/255.0 \
|
||||
blue:((float)(hexNum & 0xFF))/255.0 alpha:alpha];
|
||||
}
|
||||
+ (UIImage *)createImageWithColor:(UIColor *)color
|
||||
{
|
||||
CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return theImage;
|
||||
}
|
||||
|
||||
- (void)setNavbgColorStr:(NSString *)colorStr
|
||||
{
|
||||
|
||||
UIImage *image = [self.class createImageWithColor:[self.class colorWithHexString:colorStr]];
|
||||
[self setNavbgImage:image];
|
||||
}
|
||||
- (void)setNavbgColor:(UIColor *)color
|
||||
{
|
||||
UIImage *image = [self.class createImageWithColor:color];
|
||||
[self setNavbgImage:image];
|
||||
}
|
||||
- (void)setNavbgImage:(UIImage *)image
|
||||
{
|
||||
UINavigationController *nav = nil;
|
||||
if ([self isKindOfClass:UINavigationController.class]) {
|
||||
nav = (UINavigationController *)self;
|
||||
}else{
|
||||
nav = self.navigationController;
|
||||
}
|
||||
if (image && nav) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:nav.navigationBar];
|
||||
apperar.backgroundImage = image;
|
||||
nav.navigationBar.standardAppearance = apperar;
|
||||
nav.navigationBar.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
[nav.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(UIImage*)getNaveImage
|
||||
{
|
||||
UINavigationController *nav = nil;
|
||||
if ([self isKindOfClass:UINavigationController.class]) {
|
||||
nav = (UINavigationController *)self;
|
||||
}else{
|
||||
nav = self.navigationController;
|
||||
}
|
||||
if (nav) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:nav.navigationBar];
|
||||
return apperar.backgroundImage;
|
||||
}else{
|
||||
|
||||
return [nav.navigationBar
|
||||
backgroundImageForBarMetrics:UIBarMetricsDefault];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UINavigationBarAppearance *)getNavgationAppearanceWithNavgationController:(UINavigationBar *)bar
|
||||
API_AVAILABLE(ios(13.0)){
|
||||
if (@available(iOS 15.0, *)) {
|
||||
if (bar.standardAppearance) {
|
||||
return bar.standardAppearance;
|
||||
}
|
||||
|
||||
if (bar.scrollEdgeAppearance) {
|
||||
return bar.scrollEdgeAppearance;
|
||||
}
|
||||
|
||||
return [[UINavigationBarAppearance alloc] init];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setNavTitleColor:(UIColor *)color
|
||||
{
|
||||
UINavigationController *nav = nil;
|
||||
if ([self isKindOfClass:UINavigationController.class]) {
|
||||
nav = (UINavigationController *)self;
|
||||
}else{
|
||||
nav = self.navigationController;
|
||||
}
|
||||
if (color && nav) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:nav.navigationBar];
|
||||
apperar.titleTextAttributes = @{NSForegroundColorAttributeName:color};
|
||||
nav.navigationBar.standardAppearance = apperar;
|
||||
nav.navigationBar.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
nav.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:color};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setNavTitleFont:(UIFont *)font
|
||||
{
|
||||
UINavigationController *nav = nil;
|
||||
if ([self isKindOfClass:UINavigationController.class]) {
|
||||
nav = (UINavigationController *)self;
|
||||
}else{
|
||||
nav = self.navigationController;
|
||||
}
|
||||
if (font && nav) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:nav.navigationBar];
|
||||
apperar.titleTextAttributes = @{NSFontAttributeName:font};
|
||||
nav.navigationBar.standardAppearance = apperar;
|
||||
nav.navigationBar.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
nav.navigationBar.titleTextAttributes = @{NSFontAttributeName:font};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
- (void)setNavTitleTextAttributes:(NSDictionary*)attribute
|
||||
{
|
||||
UINavigationController *nav = nil;
|
||||
if ([self isKindOfClass:UINavigationController.class]) {
|
||||
nav = (UINavigationController *)self;
|
||||
}else{
|
||||
nav = self.navigationController;
|
||||
}
|
||||
if (attribute && nav) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:nav.navigationBar];
|
||||
apperar.titleTextAttributes = attribute;
|
||||
nav.navigationBar.standardAppearance = apperar;
|
||||
nav.navigationBar.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
nav.navigationBar.titleTextAttributes = attribute;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
#import "SonNuoCenterViewController.h"
|
||||
#import "ShopCertifyStausModel.h"
|
||||
#import "CertificationShopModel.h"
|
||||
|
||||
#import "UIViewController+Navgation.h"
|
||||
#import <SMS_SDK/SMSSDK.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@
|
|||
|
||||
LogInViewController*logvc=[[LogInViewController alloc]init];
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:logvc];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
|
||||
app1.window.rootViewController=nav;
|
||||
[app1.window makeToast:@"验证失败,密码不正确"];
|
||||
|
||||
|
|
@ -118,7 +119,7 @@
|
|||
DisconnectNetController *connectVC =[[DisconnectNetController alloc] init];
|
||||
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:connectVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}
|
||||
|
|
@ -128,7 +129,7 @@
|
|||
|
||||
DisconnectNetController *connectVC =[[DisconnectNetController alloc] init];
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:connectVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
NSString *errstr = [NSString stringWithFormat:@"%@",err];
|
||||
BLYLog(BuglyLogLevelWarn, errstr);
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:ruSuncenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}else if ([devicemodel.type isEqualToString:DECICE_TYPE_JUNENGCC]){
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:SongNuoBDcenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}else if ([devicemodel.type isEqualToString:DECICE_TYPE_RUSUN2A]){
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:RunSun84center];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
} else if ([devicemodel.type isEqualToString:DECICE_TYPE_RUIMEI]) {
|
||||
|
|
@ -194,7 +194,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:ruimeiCenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}else if ([devicemodel.type isEqualToString:DECICE_TYPE_hotBar]) {
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:none];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:twocontrolCenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
|
||||
|
|
@ -276,7 +276,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:threeControlCenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
|
||||
|
|
@ -302,7 +302,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:fourControlCenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}else if (timerAmount == 6){
|
||||
|
|
@ -314,7 +314,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app2=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:keliaicenterVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app2.window.rootViewController=nav;
|
||||
|
||||
|
||||
|
|
@ -340,7 +340,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:XuToCenter];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +358,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:songNu];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}
|
||||
|
|
@ -398,7 +398,7 @@
|
|||
UIApplication*app=[UIApplication sharedApplication];
|
||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:blackVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ static char overlayKey;
|
|||
- (void)cnSetBackgroundColor:(UIColor *)backgroundColor
|
||||
{
|
||||
if (!self.overlay) {
|
||||
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
||||
[self setClearNav];
|
||||
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -44, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 44)];
|
||||
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -64, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 64)];
|
||||
} else {
|
||||
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
|
||||
}
|
||||
|
|
@ -42,17 +42,30 @@ static char overlayKey;
|
|||
- (void)cnReset
|
||||
{
|
||||
|
||||
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
||||
[self setClearNav];
|
||||
[self.overlay removeFromSuperview];
|
||||
self.overlay = nil;
|
||||
}
|
||||
|
||||
-(void)setClearNav
|
||||
{
|
||||
|
||||
[self setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
|
||||
//设置那条横线直接隐藏
|
||||
self.shadowImage = [[UIImage alloc] init];
|
||||
NSDictionary *dic = @{NSForegroundColorAttributeName : [UIColor whiteColor],
|
||||
NSFontAttributeName : [UIFont systemFontOfSize:19]};
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *barApp = [UINavigationBarAppearance new];
|
||||
barApp.backgroundColor = [UIColor clearColor];
|
||||
barApp.titleTextAttributes = dic;
|
||||
barApp.backgroundEffect = nil;
|
||||
barApp.shadowColor = nil;
|
||||
self.scrollEdgeAppearance = nil;
|
||||
self.standardAppearance = barApp;
|
||||
}else{
|
||||
self.titleTextAttributes = dic;
|
||||
[self setShadowImage:[UIImage new]];
|
||||
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
||||
}
|
||||
//透明
|
||||
self.translucent = YES;
|
||||
if (self.overlay) {
|
||||
[self.overlay removeFromSuperview];
|
||||
self.overlay = nil;
|
||||
|
|
@ -62,17 +75,178 @@ static char overlayKey;
|
|||
|
||||
-(void)resetBackgroundImage{
|
||||
|
||||
[self setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
|
||||
[self setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
||||
|
||||
}
|
||||
|
||||
-(void)setWhiteNav
|
||||
{
|
||||
[self setBackgroundImage:[UIImage imageNamed:@"blackbar_white.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
|
||||
[self setNavbgImage:[UIImage imageNamed:@"blackbar_white.png"]];
|
||||
|
||||
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark - 私有
|
||||
+ (UIColor *)colorWithHexString:(NSString *)stringToConvert
|
||||
{
|
||||
if ([stringToConvert hasPrefix:@"#"])
|
||||
{
|
||||
stringToConvert = [stringToConvert substringFromIndex:1];
|
||||
}
|
||||
float alpha=1.0;
|
||||
if (stringToConvert.length>6&&![stringToConvert hasPrefix:@"0x"])//含有透明度
|
||||
{
|
||||
NSString*alphaString=[stringToConvert substringToIndex:2];
|
||||
NSScanner *alphaScanner = [NSScanner scannerWithString:alphaString];
|
||||
unsigned hex;
|
||||
|
||||
if (![alphaScanner scanHexInt:&hex])
|
||||
{
|
||||
alpha=1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *hexChar = [alphaString cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
int hexNumber;
|
||||
sscanf(hexChar, "%x", &hexNumber);
|
||||
|
||||
alpha=hexNumber/255.0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NSScanner *scanner = [NSScanner scannerWithString:stringToConvert];
|
||||
unsigned hexNum;
|
||||
|
||||
if (![scanner scanHexInt:&hexNum])
|
||||
{
|
||||
return [UIColor clearColor];
|
||||
}
|
||||
|
||||
return [UIColor \
|
||||
colorWithRed:((float)((hexNum & 0xFF0000) >> 16))/255.0 \
|
||||
green:((float)((hexNum & 0xFF00) >> 8))/255.0 \
|
||||
blue:((float)(hexNum & 0xFF))/255.0 alpha:alpha];
|
||||
}
|
||||
+ (UIImage *)createImageWithColor:(UIColor *)color
|
||||
{
|
||||
CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return theImage;
|
||||
}
|
||||
|
||||
- (void)setNavbgColorStr:(NSString *)colorStr
|
||||
{
|
||||
|
||||
UIImage *image = [self.class createImageWithColor:[self.class colorWithHexString:colorStr]];
|
||||
[self setNavbgImage:image];
|
||||
}
|
||||
- (void)setNavbgColor:(UIColor *)color
|
||||
{
|
||||
UIImage *image = [self.class createImageWithColor:color];
|
||||
[self setNavbgImage:image];
|
||||
}
|
||||
- (void)setNavbgImage:(UIImage *)image
|
||||
{
|
||||
|
||||
if (image) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:self];
|
||||
apperar.backgroundImage = image;
|
||||
apperar.backgroundImageContentMode=UIViewContentModeScaleAspectFill;
|
||||
self.standardAppearance = apperar;
|
||||
self.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
[self setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
|
||||
}
|
||||
}
|
||||
}
|
||||
-(UIImage*)getNaveImage
|
||||
{
|
||||
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:self];
|
||||
return apperar.backgroundImage;
|
||||
}else{
|
||||
|
||||
return [self
|
||||
backgroundImageForBarMetrics:UIBarMetricsDefault];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UINavigationBarAppearance *)getNavgationAppearanceWithNavgationController:(UINavigationBar *)bar
|
||||
API_AVAILABLE(ios(13.0)){
|
||||
if (@available(iOS 15.0, *)) {
|
||||
if (bar.standardAppearance) {
|
||||
return bar.standardAppearance;
|
||||
}
|
||||
|
||||
if (bar.scrollEdgeAppearance) {
|
||||
return bar.scrollEdgeAppearance;
|
||||
}
|
||||
|
||||
return [[UINavigationBarAppearance alloc] init];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setNavTitleColor:(UIColor *)color
|
||||
{
|
||||
|
||||
if (color ) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:self];
|
||||
apperar.titleTextAttributes = @{NSForegroundColorAttributeName:color};
|
||||
self.standardAppearance = apperar;
|
||||
self.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
self.titleTextAttributes = @{NSForegroundColorAttributeName:color};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setNavTitleFont:(UIFont *)font
|
||||
{
|
||||
if (font ) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:self];
|
||||
apperar.titleTextAttributes = @{NSFontAttributeName:font};
|
||||
self.standardAppearance = apperar;
|
||||
self.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
self.titleTextAttributes = @{NSFontAttributeName:font};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
- (void)setNavTitleTextAttributes:(NSDictionary*)attribute
|
||||
{
|
||||
|
||||
if (attribute) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
UINavigationBarAppearance *apperar = [self getNavgationAppearanceWithNavgationController:self];
|
||||
apperar.titleTextAttributes = attribute;
|
||||
self.standardAppearance = apperar;
|
||||
self.scrollEdgeAppearance = apperar;
|
||||
}else{
|
||||
self.titleTextAttributes = attribute;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
[_indicatorView stopAnimating];
|
||||
DisconnectNetController *connectVC =[[DisconnectNetController alloc] init];
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:connectVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
[UIApplication sharedApplication].delegate.window.rootViewController=nav;
|
||||
|
||||
}];
|
||||
|
|
@ -230,7 +230,7 @@
|
|||
DisconnectNetController*disconectvc=[[DisconnectNetController alloc]init];
|
||||
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:disconectvc];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
//self.window.rootViewController=nav;
|
||||
[self presentViewController:nav animated:YES completion:nil];
|
||||
|
||||
|
|
|
|||
|
|
@ -756,7 +756,7 @@ NS_ENUM(NSInteger,deviceType){
|
|||
// UIApplication*app=[UIApplication sharedApplication];
|
||||
// AppDelegate*app1=app.delegate;
|
||||
// UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:ics];
|
||||
// [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
// [nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
// app1.window.rootViewController=nav;
|
||||
|
||||
IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init];
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
[_indicatorView stopAnimating];
|
||||
DisconnectNetController *connectVC =[[DisconnectNetController alloc] init];
|
||||
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:connectVC];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
[UIApplication sharedApplication].delegate.window.rootViewController=nav;
|
||||
}];
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#import "IfishUserObsever.h"
|
||||
#import "UITabBar+addRedPointBadge.h"
|
||||
#import "LoveFishLiveListBaseViewController.h"
|
||||
#import "UIViewController+Navgation.h"
|
||||
@interface IfishMianTabViewController ()<UITabBarControllerDelegate,HomeStartAdviewDelegate>
|
||||
|
||||
@property (nonatomic,strong) NSArray *navigationHandlers;
|
||||
|
|
@ -132,7 +133,7 @@ extern BOOL launchedByNotification;
|
|||
//nav.navigationBar.backgroundColor = [UIColor redColor];
|
||||
//[nav.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
||||
//直接切图 或扩展导航UINavigationBar+Background
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
|
||||
NSString *title=titles[i];
|
||||
vc.title = title;
|
||||
|
|
@ -144,6 +145,9 @@ extern BOOL launchedByNotification;
|
|||
@{NSFontAttributeName:[UIFont systemFontOfSize:19],
|
||||
|
||||
NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[nav setNavTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:19],
|
||||
|
||||
NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
//IOS7后本项目可不做IOS7 以下处理
|
||||
UIImage *imgnomal=[UIImage imageNamed:ImageArr[i]];
|
||||
|
||||
|
|
@ -178,7 +182,7 @@ extern BOOL launchedByNotification;
|
|||
}
|
||||
[VCArr1 addObject:nav];
|
||||
}
|
||||
|
||||
self.tabBar.backgroundColor=[UIColor whiteColor];
|
||||
self.viewControllers=VCArr1;
|
||||
|
||||
if (launchedByNotification) {
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ extern BOOL firstLogIn;
|
|||
|
||||
LogInViewController*logIn=[[LogInViewController alloc]init];
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:logIn];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
[UIApplication sharedApplication].delegate.window.rootViewController = nav;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -768,11 +768,11 @@ Assign BOOL isPush;
|
|||
-(void)initUI{
|
||||
|
||||
self.automaticallyAdjustsScrollViewInsets = NO;
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"TabBarDeviceShouYeCell" bundle:nil] forCellReuseIdentifier:@"TabBarDeviceShouYeCell"];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"TabbarDeiceSecdCell" bundle:nil] forCellReuseIdentifier:@"TabbarDeiceSecdCell"];
|
||||
//CGFloat sapce=TabContentHeaght*0.011;//20/1776
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ extern BOOL firstLogIn;
|
|||
LogInViewController*logIn=[[LogInViewController alloc]init];
|
||||
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:logIn];
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
[nav setNavbgImage:[UIImage imageNamed:@"blackbar.png"]];
|
||||
app1.window.rootViewController=nav;
|
||||
|
||||
firstLogIn=NO;
|
||||
|
|
|
|||
Loading…
Reference in New Issue