How are multiple UIActionSheet
s added to a single UIViewController
if there is only a single -actionSheet:clickedButtonAtIndex:
method?
Set a Name or Tag to your Action sheet and do some thing like this
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(actionSheet==yourActionsheet1)
{
//your logic
}
if(actionSheet==yourActionsheet2)
{
//your logic
}
}
hope this help
You can create multiple action sheet as below:
actionSheet1 = [[UIActionSheet alloc] initWithTitle:@"Where to go"
delegate:self
cancelButtonTitle:@"cancel"
destructiveButtonTitle:@"Store 2"
otherButtonTitles:@"Store 3",@"Store 4",@"Store 5",@"View Store Profile",nil];
actionSheet2 = [[UIActionSheet alloc] initWithTitle:@"Where to go"
delegate:self
cancelButtonTitle:@"cancel"
destructiveButtonTitle:@"Store 1"
otherButtonTitles:@"Store 3",@"Store 4",@"Store 5",@"View Store Profile",nil];
actionSheet3 = [[UIActionSheet alloc] initWithTitle:@"Where to go"
delegate:self
cancelButtonTitle:@"cancel"
destructiveButtonTitle:@"Store 1"
otherButtonTitles:@"Store 2",@"Store 4",@"Store 5",@"View Store Profile",nil];
& after that chek out which action sheet is called by - (void) actionSheet: (UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
if(actionSheet==actionSheet1)
{
}
else if(actionSheet==actionSheet2)
{
}
else if(actionSheet==actionSheet3)
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With