I want to have two Action Sheets, but how can I know for which of them is called method 开发者_开发问答-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
I would set the tag of those action sheets and checks the tag in the clickedButtonAtIndex.
When you create your action sheet, store a reference and then check in the delegate method.
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (actionSheet == actionSheet1) {
// do something
}
else if (actionSheet == actionSheet2) {
// do something else
{
}
Careful this will not work when cancel is tapped in each of the action sheets You need to clear actionsheet1 if cancel is selected in the first actionsheet and actionsheet2 if cancel is selected in second actionsheet.
精彩评论