views:

254

answers:

1

I'm pretty new to iPhone dev, so any help is appreciated.

I am creating an action sheet within a function and adding it to the current view. I have the sheet delegate as 'self' and the action sheet is not retained. Is there a function like the datePicker's didSelectRow? Something like "didDismissWithButtonAtIndex" or something that lets me detect when an action sheet is closing?

Thanks, Mike

+2  A: 

The UIActionSheetDelegate method – actionSheet:didDismissWithButtonIndex: is what you're looking for. From the documentation:

actionSheet:didDismissWithButtonIndex:

Sent to the delegate after an action sheet is dismissed from the screen.

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

Parameters
actionSheet
The action sheet that was dismissed.

buttonIndex
The index of the button that was clicked. The button indices start at 0. If this is the cancel button index, the action sheet is canceling. If -1, the cancel button index is not set.

Discussion
This method is invoked after the animation ends and the view is hidden.

Carl Norum