Skip to content
Browse files

added reference to current actionSheet so that we wont be able to sho…

…w infinite actionSheets on iPad from the action button
  • Loading branch information...
1 parent 07bf3dd commit 28aeeaa42d4b3d4f39841133cb06402d94d81caa @OliverLetterer OliverLetterer committed Sep 24, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −0 SVWebViewController/SVWebViewController.h
  2. +6 −1 SVWebViewController/SVWebViewController.m
View
1 SVWebViewController/SVWebViewController.h
@@ -12,6 +12,7 @@
UIWebView *_webView;
NSURL *_URL;
+ UIActionSheet *_actionSheet;
UIBarButtonItem *_backBarButtonItem, *_forwardBarButtonItem, *_refreshBarButtonItem, *_stopBarButtonItem, *_actionBarButtonItem;
}
View
7 SVWebViewController/SVWebViewController.m
@@ -225,13 +225,17 @@ - (void)_stopClicked:(UIBarButtonItem *)sender {
}
- (void)_actionButtonClicked:(id)sender {
+ if (_actionSheet) {
+ // we are already showing an actionSheet, return
+ return;
+ }
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"Open in Safari", @""), nil] autorelease];
-
+ _actionSheet = actionSheet;
if([MFMailComposeViewController canSendMail]) {
[actionSheet addButtonWithTitle:NSLocalizedString(@"Mail Link to this Page", @"")];
@@ -252,6 +256,7 @@ - (void)_actionButtonClicked:(id)sender {
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *title = nil;
+ _actionSheet = nil;
@try {
title = [actionSheet buttonTitleAtIndex:buttonIndex];

0 comments on commit 28aeeaa

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