Skip to content

Commit

Permalink
Merge pull request #6603 from vishalduggal/timob-16121
Browse files Browse the repository at this point in the history
[TIMOB-16121] Support navBarHidden on TiWindow
  • Loading branch information
pec1985 committed Jan 27, 2015
2 parents 99bbb06 + 4343805 commit 1ad97a1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
39 changes: 1 addition & 38 deletions iphone/Classes/TiUIWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -313,32 +313,6 @@ - (void)viewDidDisappear:(BOOL)animated; // Called after the view was dismissed

#pragma mark - UINavController, NavItem UI


-(void)showNavBar:(NSArray*)args
{
ENSURE_UI_THREAD(showNavBar,args);
[self replaceValue:[NSNumber numberWithBool:NO] forKey:@"navBarHidden" notification:NO];
if (controller!=nil)
{
id properties = (args!=nil && [args count] > 0) ? [args objectAtIndex:0] : nil;
BOOL animated = [TiUtils boolValue:@"animated" properties:properties def:YES];
[[controller navigationController] setNavigationBarHidden:NO animated:animated];
}
}

-(void)hideNavBar:(NSArray*)args
{
ENSURE_UI_THREAD(hideNavBar,args);
[self replaceValue:[NSNumber numberWithBool:YES] forKey:@"navBarHidden" notification:NO];
if (controller!=nil)
{
id properties = (args!=nil && [args count] > 0) ? [args objectAtIndex:0] : nil;
BOOL animated = [TiUtils boolValue:@"animated" properties:properties def:YES];
[[controller navigationController] setNavigationBarHidden:YES animated:animated];
//TODO: need to fix height
}
}

-(void)setNavTintColor:(id)colorString
{
NSString *color = [TiUtils stringValue:colorString];
Expand Down Expand Up @@ -855,7 +829,7 @@ -(void)setTitle:(NSString*)title_
if (shouldUpdateNavBar && controller != nil && [controller navigationController] != nil) {
controller.navigationItem.title = title;
}
}, NO);
}, [NSThread isMainThread]);
}

-(void)setTitlePrompt:(NSString*)title_
Expand Down Expand Up @@ -998,17 +972,6 @@ -(void)setupWindowDecorations
[self updateBarImage];
[self updateNavButtons];
[self refreshBackButton];

id navBarHidden = [self valueForKey:@"navBarHidden"];
if (navBarHidden!=nil) {
id properties = [NSArray arrayWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"animated"]];
if ([TiUtils boolValue:navBarHidden]) {
[self hideNavBar:properties];
}
else {
[self showNavBar:properties];
}
}
}

-(void)cleanupWindowDecorations
Expand Down
37 changes: 37 additions & 0 deletions iphone/Classes/TiWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,47 @@ -(TiOrientationFlags) orientationFlags
return _supportedOrientations;
}


-(void)showNavBar:(NSArray*)args
{
ENSURE_UI_THREAD(showNavBar,args);
[self replaceValue:[NSNumber numberWithBool:NO] forKey:@"navBarHidden" notification:NO];
if (controller!=nil)
{
id properties = (args!=nil && [args count] > 0) ? [args objectAtIndex:0] : nil;
BOOL animated = [TiUtils boolValue:@"animated" properties:properties def:YES];
[[controller navigationController] setNavigationBarHidden:NO animated:animated];
}
}

-(void)hideNavBar:(NSArray*)args
{
ENSURE_UI_THREAD(hideNavBar,args);
[self replaceValue:[NSNumber numberWithBool:YES] forKey:@"navBarHidden" notification:NO];
if (controller!=nil)
{
id properties = (args!=nil && [args count] > 0) ? [args objectAtIndex:0] : nil;
BOOL animated = [TiUtils boolValue:@"animated" properties:properties def:YES];
[[controller navigationController] setNavigationBarHidden:YES animated:animated];
//TODO: need to fix height
}
}


#pragma mark - Appearance and Rotation Callbacks. For subclasses to override.
//Containing controller will call these callbacks(appearance/rotation) on contained windows when it receives them.
-(void)viewWillAppear:(BOOL)animated
{
id navBarHidden = [self valueForKey:@"navBarHidden"];
if (navBarHidden!=nil) {
id properties = [NSArray arrayWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"animated"]];
if ([TiUtils boolValue:navBarHidden]) {
[self hideNavBar:properties];
}
else {
[self showNavBar:properties];
}
}
[self willShow];
}
-(void)viewWillDisappear:(BOOL)animated
Expand Down

0 comments on commit 1ad97a1

Please sign in to comment.