The UIActionSheet
class has a visible
property. This returns YES
if the action sheet is showing, NO
if it isn't. That should enable you to know whether or not it's been dismissed.
You could also implement some UIActionSheetDelegate
methods to know when it's been dismissed or cancelled using actionSheetCancel:
and/or actionSheet:didDismissWithButtonIndex:
.
EDIT:
To be sure to receive the delegate calls of your UIActionSheet, be sure to indicate in your controller's interface declaration (.h):
@interface YourViewController : UIViewController<UIActionSheetDelegate>
@end
Then in the controller's implementation (.m) :
- (void)actionSheetCancel:(UIActionSheet *)actionSheet {
NSLog(@"action sheet is about to be cancelled");
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"action sheet was dismissed");
}
EDIT 2:
I've just had a look at the code of the SHKActionSheet
class and it turns out it doesn't implement the actionSheetCancel:
method, which is why you're not receiving it. It does, however, implement the actionSheet:didDismissWithButtonIndex:
method :
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
{
// Sharers
if (buttonIndex >= 0 && buttonIndex < sharers.count)
{
[NSClassFromString([sharers objectAtIndex:buttonIndex]) performSelector:@selector(shareItem:) withObject:item];
}
// More
else if (buttonIndex == sharers.count)
{
SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc] initWithStyle:UITableViewStyleGrouped];
shareMenu.item = item;
[[SHK currentHelper] showViewController:shareMenu];
[shareMenu release];
}
[super dismissWithClickedButtonIndex:buttonIndex animated:animated];
}
If you want to be notified of the actionSheetCancel:
method, simply add this to the SHKActionSheet.m file :
- (void)actionSheetCancel:(UIActionSheet *)actionSheet {
[super actionSheetCancel:actionSheet];
}
The delegate method in your controller will then be called properly :)
UIActionSheet Class Reference
UIActionSheetDelegate Protocol Reference