Skip to content

Instantly share code, notes, and snippets.

@shric
Created June 7, 2012 05:38
Show Gist options
  • Save shric/e9021a581e770a6741ef to your computer and use it in GitHub Desktop.
Save shric/e9021a581e770a6741ef to your computer and use it in GitHub Desktop.
diff --git a/BSPApp/Classes/BSPSubsectionHelpController.m b/BSPApp/Classes/BSPSubsectionHelpController.m
index 74acc16..f890fcd 100644
--- a/BSPApp/Classes/BSPSubsectionHelpController.m
+++ b/BSPApp/Classes/BSPSubsectionHelpController.m
@@ -137,8 +137,13 @@
else {
BSPWebViewController *webctr = [[[BSPWebViewController alloc] initWithURL:[request URL]] autorelease];
//[self.navigationController pushViewController:webctr animated:YES];
- webctr.modalPresentationStyle = UIModalPresentationCurrentContext;
- [self.parentViewController presentModalViewController:webctr animated:YES];
+ webctr.modalPresentationStyle = UIModalPresentationCurrentContext;
+
+ if ([self.parentViewController respondsToSelector:@selector(presentViewController:animated:completion:)]) { // iOS 5.0 and after
+ [self.parentViewController presentViewController:webctr animated:YES completion:NULL];
+ } else { // Before iOS 5.0
+ [self.parentViewController presentModalViewController:webctr animated:YES];
+ }
return NO;
}
}
diff --git a/BSPApp/Classes/BSPTemplateObject.m b/BSPApp/Classes/BSPTemplateObject.m
index d5be65d..615b799 100644
--- a/BSPApp/Classes/BSPTemplateObject.m
+++ b/BSPApp/Classes/BSPTemplateObject.m
@@ -11,7 +11,7 @@
#import "BSPTemplateObject.h"
@interface BSPTemplateObject() {
- NSDictionary *_dict;
+ NSDictionary *_dct;
NSString *_refKey;
}
@property (nonatomic, readonly) NSSet *_validKeys;
diff --git a/BSPApp/Classes/BSPWebViewController.m b/BSPApp/Classes/BSPWebViewController.m
index ec8b1d0..51e1072 100644
--- a/BSPApp/Classes/BSPWebViewController.m
+++ b/BSPApp/Classes/BSPWebViewController.m
@@ -183,7 +183,10 @@
[_toolbarItems addObject:_reloadOrStopItem];
[_toolbarItems addObject:_forwardItem];
- if (self.parentViewController.modalViewController == self) {
+ if (
+ self.parentViewController.modalViewController == self || // Before iOS 5.0
+ ([self respondsToSelector:@selector(presentingViewController)] && self.presentingViewController)) // iOS 5.0 and above
+ {
UIBarButtonItem *doneItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(_done)] autorelease];
@@ -213,7 +216,11 @@
}
- (void)_done {
- [self.parentViewController dismissModalViewControllerAnimated:YES];
+ if ([self respondsToSelector:@selector(presentingViewController)]) { // iOS 5.0 and later
+ [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
+ } else { // Before iOS 5.0
+ [self.parentViewController dismissModalViewControllerAnimated:YES];
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment