开发者

How do I detect when a UIActionSheet has been dismissed?

开发者 https://www.devze.com 2022-12-21 00:03 出处:网络
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 shee

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 "didDismissWi开发者_StackOverflow社区thButtonAtIndex" or something that lets me detect when an action sheet is closing?

Thanks, Mike


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.


NSLog(@"actionsheetvisible %@", actionSheet.isVisible?@"YES":@"NO");

Use the isVisible property.

0

精彩评论

暂无评论...
验证码 换一张
取 消