summaryrefslogtreecommitdiff
path: root/UICaboodle
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-23 20:30:11 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-07 02:41:13 -0800
commit5cdfcd6ff1223d3200b8f8a051b07f137e353604 (patch)
treec89dc338739d2c28d2f771b1a5ed558ca559c56d /UICaboodle
parent3c62d6548fe3f893f4e90bce73b2463cef8faccd (diff)
Export cydia.setHidesNavigationBar() to JavaScript.
Diffstat (limited to 'UICaboodle')
-rw-r--r--UICaboodle/BrowserView.h4
-rw-r--r--UICaboodle/BrowserView.mm36
2 files changed, 38 insertions, 2 deletions
diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h
index 32ef3b4..f44e6ba 100644
--- a/UICaboodle/BrowserView.h
+++ b/UICaboodle/BrowserView.h
@@ -90,6 +90,9 @@
UIBarButtonItem *reloaditem_;
UIBarButtonItem *loadingitem_;
+
+ bool visible_;
+ bool hidesNavigationBar_;
}
+ (void) _initialize;
@@ -120,6 +123,7 @@
- (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
- (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
- (void) setPopupHook:(id)function;
+- (void) setHidesNavigationBar:(bool)value;
- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
- (void) customButtonClicked;
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index b4ca1a1..494dd69 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -820,6 +820,8 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
function_ = nil;
CYRelease(closer_);
+ [self setHidesNavigationBar:NO];
+
// XXX: do we still need to do this?
[[self navigationItem] setTitle:nil];
}
@@ -1211,24 +1213,54 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
}
}
+- (bool) hidesNavigationBar {
+ return hidesNavigationBar_;
+}
+
+- (void) _setHidesNavigationBar:(bool)value animated:(bool)animated {
+ if (visible_)
+ [[self navigationController] setNavigationBarHidden:(value && [self hidesNavigationBar]) animated:animated];
+}
+
+- (void) setHidesNavigationBar:(bool)value {
+ if (hidesNavigationBar_ != value) {
+ hidesNavigationBar_ = value;
+ [self _setHidesNavigationBar:YES animated:YES];
+ }
+}
+
+- (void) setHidesNavigationBarByNumber:(NSNumber *)value {
+ [self setHidesNavigationBar:[value boolValue]];
+}
+
- (void) viewWillAppear:(BOOL)animated {
+ visible_ = true;
+
+ if ([self hidesNavigationBar])
+ [self _setHidesNavigationBar:YES animated:animated];
+
[self dispatchEvent:@"CydiaViewWillAppear"];
[super viewWillAppear:animated];
}
- (void) viewDidAppear:(BOOL)animated {
- [self dispatchEvent:@"CydiaViewDidAppear"];
[super viewDidAppear:animated];
+ [self dispatchEvent:@"CydiaViewDidAppear"];
}
- (void) viewWillDisappear:(BOOL)animated {
[self dispatchEvent:@"CydiaViewWillDisappear"];
[super viewWillDisappear:animated];
+
+ if ([self hidesNavigationBar])
+ [self _setHidesNavigationBar:NO animated:animated];
+
+ visible_ = false;
}
- (void) viewDidDisappear:(BOOL)animated {
- [self dispatchEvent:@"CydiaViewDidDisappear"];
[super viewDidDisappear:animated];
+ [self dispatchEvent:@"CydiaViewDidDisappear"];
}
@end