Skip to content

Commit

Permalink
Add support for tiniting navBar on IOS7
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalduggal committed Aug 23, 2013
1 parent 68a0ef3 commit b2c30df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions iphone/Classes/TiUIWindowProxy.m
Expand Up @@ -126,6 +126,7 @@ -(void)_destroy
-(void)_configure
{
[self replaceValue:nil forKey:@"barColor" notification:NO];
[self replaceValue:nil forKey:@"navTintColor" notification:NO];
[self replaceValue:nil forKey:@"barImage" notification:NO];
[self replaceValue:nil forKey:@"translucent" notification:NO];
[self replaceValue:NUMBOOL(NO) forKey:@"tabBarHidden" notification:NO];
Expand Down Expand Up @@ -334,6 +335,23 @@ -(void)hideNavBar:(NSArray*)args
}
}

-(void)setNavTintColor:(id)colorString
{
if (![TiUtils isIOS7OrGreater]) {
[self replaceValue:[TiUtils stringValue:colorString] forKey:@"navTintColor" notification:NO];
return;
}
ENSURE_UI_THREAD(setNavTintColor,colorString);
NSString *color = [TiUtils stringValue:colorString];
[self replaceValue:color forKey:@"navTintColor" notification:NO];
if (controller!=nil) {
TiColor * newColor = [TiUtils colorValue:color];
UINavigationBar * navBar = [[controller navigationController] navigationBar];
[navBar setTintColor:[newColor color]];
[self performSelector:@selector(refreshBackButton) withObject:nil afterDelay:0.0];
}
}

-(void)setBarColor:(id)colorString
{
ENSURE_UI_THREAD(setBarColor,colorString);
Expand Down Expand Up @@ -821,6 +839,7 @@ -(void)setupWindowDecorations
SETPROP(@"titlePrompt",setTitlePrompt);
[self updateTitleView];
SETPROP(@"barColor",setBarColor);
SETPROP(@"navTintColor",setNavTintColor);
SETPROP(@"translucent",setTranslucent);
SETPROP(@"tabBarHidden",setTabBarHidden);
SETPROPOBJ(@"leftNavButton",setLeftNavButton);
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/TiUtils.m
Expand Up @@ -1452,7 +1452,8 @@ +(void)applyColor:(TiColor *)color toNavigationController:(UINavigationControlle
} else {
[navBar setTintColor:barColor];
}


//This should not be here but in setToolBar. But keeping in place. Clean in 3.2.0
UIToolbar * toolBar = [navController toolbar];
[toolBar setBarStyle:barStyle];
[toolBar setTranslucent:isTranslucent];
Expand Down

0 comments on commit b2c30df

Please sign in to comment.