[ios] Refactored navigation bar appearance.

This commit is contained in:
Илья Гречухин 2015-12-28 17:34:31 +03:00 committed by Sergey Yershov
parent 0714789cb9
commit c79043734c
2 changed files with 23 additions and 8 deletions

View file

@ -49,4 +49,6 @@ typedef NS_ENUM(NSUInteger, MWMRoutingPlaneMode)
- (void)setMapStyle:(MapStyle)mapStyle;
- (void)customizeAppearanceForNavigationBar:(UINavigationBar *)navigationBar;
@end

View file

@ -512,21 +512,33 @@ void InitLocalizedStrings()
[self.mapViewController setMapStyle: mapStyle];
}
+ (void)customizeAppearance
(NSDictionary *)navigationBarTextAttributes
{
NSDictionary * attributes = @{
return @{
NSForegroundColorAttributeName : [UIColor whitePrimaryText],
NSFontAttributeName : [UIFont regular18]
};
}
UINavigationBar * navBar = [UINavigationBar appearance];
navBar.tintColor = [UIColor primary];
navBar.barTintColor = [UIColor primary];
navBar.shadowImage = [UIImage imageWithColor:[UIColor fadeBackground]];
navBar.titleTextAttributes = attributes;
- (void)customizeAppearanceForNavigationBar:(UINavigationBar *)navigationBar
{
navigationBar.tintColor = [UIColor primary];
navigationBar.barTintColor = [UIColor primary];
[navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
navigationBar.shadowImage = [UIImage imageWithColor:[UIColor fadeBackground]];
navigationBar.titleTextAttributes = [self navigationBarTextAttributes];
navigationBar.translucent = NO;
}
- (void)customizeAppearance
{
[self customizeAppearanceForNavigationBar:[UINavigationBar appearance]];
UIBarButtonItem * barBtn = [UIBarButtonItem appearance];
[barBtn setTitleTextAttributes:attributes forState:UIControlStateNormal];
[barBtn setTitleTextAttributes:[self navigationBarTextAttributes] forState:UIControlStateNormal];
[barBtn setTitleTextAttributes:@{
NSForegroundColorAttributeName : [UIColor lightGrayColor],
} forState:UIControlStateDisabled];
barBtn.tintColor = [UIColor whitePrimaryText];
UIPageControl * pageControl = [UIPageControl appearance];
@ -535,6 +547,7 @@ void InitLocalizedStrings()
pageControl.backgroundColor = [UIColor white];
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[[LocalNotificationManager sharedManager] processNotification:notification onLaunch:NO];