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

[TIMOB-15284] Fix Set Status Bar Style #4709

Merged
merged 2 commits into from
Oct 8, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/Window.yml
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ properties:
summary: The status bar style associated with this window.
description: |
Sets the status bar style when this window gains focus. This is now the recommended way to control the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sets status bar style when window has focus

status bar style on the application. Must be specified **before** the the window is opened.
status bar style on the application.

If this value is undefined, the value is set to UIStatusBarStyle defined in tiapp.xml.
If that is not defined it defaults to <Titanium.UI.iPhone.StatusBar.DEFAULT>.
Expand Down
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/iPhone/iPhone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ properties:
summary: Determines the status bar color style.
description: |
The setter for this property does not work on iOS 7 and is deprecated for earlier iOS versions since **Release 3.1.3**.
Use the [statusBarStyle](Titanium.UI.Window.statusBarStyle) property of the window to control the staus bar style.
Use the [statusBarStyle](Titanium.UI.Window.statusBarStyle) property of the window to control the status bar style.

One of the group of status bar style constants
<Titanium.UI.iPhone.StatusBar.DEFAULT>,
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ -(BOOL) modalPresentationCapturesStatusBarAppearance
- (void) updateStatusBar
{
if ([TiUtils isIOS7OrGreater] && viewControllerControlsStatusBar) {
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate) withObject:nil];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate) onThread:[NSThread mainThread] withObject:nil waitUntilDone:NO];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo this change

} else {
[[UIApplication sharedApplication] setStatusBarHidden:[self prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle] animated:NO];
Expand Down
21 changes: 21 additions & 0 deletions iphone/Classes/TiWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ -(void)open:(id)args

}

-(void)setStatusBarStyle:(id)style
{
int theStyle = [TiUtils intValue:style def:[[[TiApp app] controller] defaultStatusBarStyle]];
switch (theStyle){
case UIStatusBarStyleDefault:
barStyle = UIStatusBarStyleDefault;
break;
case UIStatusBarStyleBlackOpaque:
case UIStatusBarStyleBlackTranslucent: //This will also catch UIStatusBarStyleLightContent
if ([TiUtils isIOS7OrGreater]) {
barStyle = 1;//UIStatusBarStyleLightContent;
} else {
barStyle = theStyle;
}
break;
default:
barStyle = UIStatusBarStyleDefault;
}
[[TiApp controller] updateStatusBar];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(focussed) {
TiThreadPerformOnMainThread(^{
[[[TiApp app] controller] updateStatusBar];
}, YES);
}

}

-(void)close:(id)args
{
//I am not open. Go Away
Expand Down