Permalink
Browse files

Now status bar updates its style correctly

  • Loading branch information...
1 parent f201b57 commit 0da07a8de79a28c6c0924465e170957c2f3dcbac @tonisalae committed Sep 24, 2012
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -83,6 +83,28 @@ -(void) dismissController {
}
}
+/*-(void) setStatusBarStyle
+{
+ UIStatusBarStyle statusStyle = UIStatusBarStyleDefault;
+ switch (barStyle) {
+ case UIBarStyleDefault:
+ statusStyle = UIStatusBarStyleDefault;
+ break;
+
+ case UIBarStyleBlack:
+ case UIBarStyleBlackOpaque:
+ statusStyle = UIStatusBarStyleBlackOpaque;
+ break;
+
+ case UIBarStyleBlackTranslucent:
+ statusStyle = UIStatusBarStyleBlackTranslucent;
+ break;
+
+ default:
+ break;
+ }
+}*/
+
//Added in the dealloc method to remove the webview delegate, because if you use this in a navigation controller
//TSMiniWebBrowser can get deallocated while the page is still loading and the web view will call its delegate-- resulting in a crash
-(void)dealloc
@@ -92,6 +114,7 @@ -(void)dealloc
#pragma mark - Init
+// This method is only used in modal mode
-(void) initTitleBar {
UIBarButtonItem *buttonDone = [[UIBarButtonItem alloc] initWithTitle:modalDismissButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(dismissController)];
@@ -204,6 +227,7 @@ - (id)initWithUrl:(NSURL*)url {
showActionButton = YES;
modalDismissButtonTitle = NSLocalizedString(@"Done", nil);
forcedTitleBarText = nil;
+ barStyle = UIBarStyleDefault;
}
return self;
@@ -241,6 +265,9 @@ - (void)viewDidLoad
[self initTitleBar];
}
+ // Status bar style
+ [[UIApplication sharedApplication] setStatusBarStyle:barStyle animated:YES];
+
// UI state
buttonGoBack.enabled = NO;
buttonGoForward.enabled = NO;
@@ -262,6 +289,9 @@ -(void) viewWillDisappear:(BOOL)animated {
if (mode == TSMiniWebBrowserModeNavigation) {
self.navigationController.navigationBar.barStyle = originalBarStyle;
}
+
+ // Restore Status bar style
+ [[UIApplication sharedApplication] setStatusBarStyle:originalBarStyle animated:NO];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
@@ -28,6 +28,7 @@
6F96DB7714E014620088FAFB /* first@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6F96DB7314E014620088FAFB /* first@2x.png */; };
6F96DB7814E014620088FAFB /* second.png in Resources */ = {isa = PBXBuildFile; fileRef = 6F96DB7414E014620088FAFB /* second.png */; };
6F96DB7914E014620088FAFB /* second@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6F96DB7514E014620088FAFB /* second@2x.png */; };
+ E2EC79A2161033B2002A923D /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E2EC79A1161033B2002A923D /* Default-568h@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -58,6 +59,7 @@
6F96DB7314E014620088FAFB /* first@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "first@2x.png"; sourceTree = "<group>"; };
6F96DB7414E014620088FAFB /* second.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = second.png; sourceTree = "<group>"; };
6F96DB7514E014620088FAFB /* second@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "second@2x.png"; sourceTree = "<group>"; };
+ E2EC79A1161033B2002A923D /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -77,6 +79,7 @@
6F69CDA514C6339C00BB6C57 = {
isa = PBXGroup;
children = (
+ E2EC79A1161033B2002A923D /* Default-568h@2x.png */,
6F69CE4714C6E89600BB6C57 /* icon@2x.png */,
6F69CE4514C6E89300BB6C57 /* icon.png */,
6F69CDD114C636D700BB6C57 /* TSMiniWebBrowser */,
@@ -227,6 +230,7 @@
6F96DB7714E014620088FAFB /* first@2x.png in Resources */,
6F96DB7814E014620088FAFB /* second.png in Resources */,
6F96DB7914E014620088FAFB /* second@2x.png in Resources */,
+ E2EC79A2161033B2002A923D /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -38,7 +38,7 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- BOOL wantTabBarDemo = NO;
+ BOOL wantTabBarDemo = YES;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

0 comments on commit 0da07a8

Please sign in to comment.