Permalink
Browse files

Fix issue #254 - IOS 5 Cancel Button.

  • Loading branch information...
1 parent 9139332 commit e741af1f120faab2342e1811c17d649a06f922d4 Nathan Corvino committed Oct 20, 2011
Showing with 12 additions and 2 deletions.
  1. +12 −2 Classes/ShareKit/Core/SHK.m
@@ -127,7 +127,13 @@ - (void)showViewController:(UIViewController *)vc
if (currentView != nil)
{
self.pendingView = vc;
- [[currentView parentViewController] dismissModalViewControllerAnimated:YES];
+ if ([currentView respondsToSelector:@selector(presentingViewController)]) {
+ [[currentView presentingViewController] dismissModalViewControllerAnimated:YES];
+ }
+ else
+ {
+ [[currentView parentViewController] dismissModalViewControllerAnimated:YES];
+ }
return;
}
@@ -179,7 +185,11 @@ - (void)hideCurrentViewControllerAnimated:(BOOL)animated
if (currentView != nil)
{
// Dismiss the modal view
- if ([currentView parentViewController] != nil)
+ if ([currentView respondsToSelector:@selector(presentingViewController)] && [currentView presentingViewController] != nil) {
+ self.isDismissingView = YES;
+ [[currentView presentingViewController] dismissModalViewControllerAnimated:animated];
+ }
+ else if ([currentView parentViewController] != nil)
{
self.isDismissingView = YES;
[[currentView parentViewController] dismissModalViewControllerAnimated:animated];

0 comments on commit e741af1

Please sign in to comment.