Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/bug_fix_nav_bar_color #42

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// AppLovin SDK is initialized, start loading ads now or later if ad gate is reached
}];

UIColor *barTintColor = [UIColor colorWithRed: 10/255.0 green: 131/255.0 blue: 170/255.0 alpha: 1.0];
if ( @available(iOS 15.0, *) )
{
UINavigationBarAppearance *navigationBarAppearance = [[UINavigationBarAppearance alloc] init];
[navigationBarAppearance configureWithOpaqueBackground];
navigationBarAppearance.backgroundColor = barTintColor;
navigationBarAppearance.titleTextAttributes = @{NSForegroundColorAttributeName : UIColor.whiteColor};
[UINavigationBar appearance].standardAppearance = navigationBarAppearance;
[UINavigationBar appearance].scrollEdgeAppearance = navigationBarAppearance;
[UINavigationBar appearance].tintColor = UIColor.whiteColor;
}
else
{
// Fallback on earlier versions
[UINavigationBar appearance].barTintColor = barTintColor;
[UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName : UIColor.whiteColor};
[UINavigationBar appearance].tintColor = UIColor.whiteColor;
}

return YES;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ class ALAppDelegate: UIResponder, UIApplicationDelegate
// AppLovin SDK is initialized, start loading ads now or later if ad gate is reached
})

let barTintColor = UIColor.init(red: 10/255.0, green: 131/255.0, blue: 170/255.0, alpha: 1.0)
let navigationBarAppearance = UINavigationBar.appearance()
if #available(iOS 15.0, *)
{
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = barTintColor
appearance.titleTextAttributes = [.foregroundColor : UIColor.white]
navigationBarAppearance.standardAppearance = appearance
navigationBarAppearance.scrollEdgeAppearance = appearance
navigationBarAppearance.tintColor = .white
}
else
{
// Fallback on earlier versions
navigationBarAppearance.isTranslucent = false
navigationBarAppearance.barTintColor = barTintColor
navigationBarAppearance.titleTextAttributes = [.foregroundColor : UIColor.white]
navigationBarAppearance.tintColor = .white
}

return true
}
}