Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes issue where Cancel button doesn't respond in iOS5

  • Loading branch information...
commit 673ecc94ecc7d81393af094e105a63e3b96a62ba 1 parent 9139332
Justin Reese authored November 13, 2011

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. 14  Classes/ShareKit/Core/SHK.m
14  Classes/ShareKit/Core/SHK.m
@@ -127,7 +127,13 @@ - (void)showViewController:(UIViewController *)vc
127 127
 	if (currentView != nil)
128 128
 	{
129 129
 		self.pendingView = vc;
130  
-		[[currentView parentViewController] dismissModalViewControllerAnimated:YES];
  130
+		if ([currentView respondsToSelector:@selector(presentingViewController)]) {
  131
+			[[currentView presentingViewController] dismissModalViewControllerAnimated:YES];
  132
+		}
  133
+		else
  134
+		{
  135
+			[[currentView parentViewController] dismissModalViewControllerAnimated:YES];
  136
+		}
131 137
 		return;
132 138
 	}
133 139
 		
@@ -179,7 +185,11 @@ - (void)hideCurrentViewControllerAnimated:(BOOL)animated
179 185
 	if (currentView != nil)
180 186
 	{
181 187
 		// Dismiss the modal view
182  
-		if ([currentView parentViewController] != nil)
  188
+		if ([currentView respondsToSelector:@selector(presentingViewController)] && [currentView presentingViewController] != nil) {
  189
+			self.isDismissingView = YES;
  190
+			[[currentView presentingViewController] dismissModalViewControllerAnimated:animated];
  191
+		}
  192
+		else if ([currentView parentViewController] != nil)
183 193
 		{
184 194
 			self.isDismissingView = YES;
185 195
 			[[currentView parentViewController] dismissModalViewControllerAnimated:animated];

0 notes on commit 673ecc9

Please sign in to comment.
Something went wrong with that request. Please try again.