summaryrefslogtreecommitdiff
path: root/CyteKit
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-12-23 22:41:50 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-12-23 22:52:05 -0800
commit19f2d77f02510fd14320166f45a33e6aa77cb396 (patch)
tree58faf4628aa9126578562691b4bff3b1fc39248e /CyteKit
parentf9257f618734672534a3955c16aa83acfa5e1786 (diff)
"Oh, my God... they killed parentViewController!"v1.1.3
Diffstat (limited to 'CyteKit')
-rw-r--r--CyteKit/ViewController.h1
-rw-r--r--CyteKit/ViewController.mm8
-rw-r--r--CyteKit/WebViewController.mm4
3 files changed, 11 insertions, 2 deletions
diff --git a/CyteKit/ViewController.h b/CyteKit/ViewController.h
index f707ba2..6cbff24 100644
--- a/CyteKit/ViewController.h
+++ b/CyteKit/ViewController.h
@@ -48,6 +48,7 @@
- (BOOL) hasLoaded;
- (void) reloadData;
- (void) unloadData;
+- (UIViewController *) parentOrPresentingViewController;
@end
@interface CyteViewController : UIViewController {
diff --git a/CyteKit/ViewController.mm b/CyteKit/ViewController.mm
index a25da53..3d22f60 100644
--- a/CyteKit/ViewController.mm
+++ b/CyteKit/ViewController.mm
@@ -59,6 +59,14 @@ extern bool IsWildcat_;
[modal unloadData];
}
+- (UIViewController *) parentOrPresentingViewController {
+ if (UIViewController *parent = [self parentViewController])
+ return parent;
+ if ([self respondsToSelector:@selector(presentingViewController)])
+ return [self presentingViewController];
+ return nil;
+}
+
@end
@implementation CyteViewController
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm
index 25e9aeb..cfe01f7 100644
--- a/CyteKit/WebViewController.mm
+++ b/CyteKit/WebViewController.mm
@@ -630,7 +630,7 @@ float CYScrollViewDecelerationRateNormal;
// }}}
- (void) close {
- [[[self navigationController] parentViewController] dismissModalViewControllerAnimated:YES];
+ [[[self navigationController] parentOrPresentingViewController] dismissModalViewControllerAnimated:YES];
}
- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button {
@@ -714,7 +714,7 @@ float CYScrollViewDecelerationRateNormal;
return nil;
if (UINavigationController *navigation = [self navigationController])
- if ([[navigation parentViewController] modalViewController] == navigation)
+ if ([[navigation parentOrPresentingViewController] modalViewController] == navigation)
return [[[UIBarButtonItem alloc]
initWithTitle:UCLocalize("CLOSE")
style:UIBarButtonItemStylePlain