Hi here i developing small application. In a subclass screen i have two buttons. When i press the first button, it will shows four actionsheet. When i press second button it wil shows five actionsheet. I was successfully shows it. But i cant set second button actions of five actionsheet. In my code the when i press second button of first actionsheet, it wil actioned first button of first actionsheet. Here i want set actions for individual actionsheets. Pls help me. Here is my code is
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ( indexPath.row == 0)
{
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Edit" otherButtonTitles:@"Remove", @"Sell",@"Scrap", nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popupQuery showInView:self.view];
[popupQuery release];
}
if ( indexPath.row == 1 )
{
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Unsell" otherButtonTitles:@"Edit Item", @"Edit Sale",@"Sold",@"Scrap", nil];
popupQuery.tag=5;
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:self.view];
[popupQuery release];
}
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{
Updateasset *object=[[Updateasset alloc]initWithNibName:@"Updateasset" bundle:nil];
[self presentModalViewController:object animated:NO];
[object release];
}
else if (buttonIndex == 1)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Remove" message:@"Do you want to Remove"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
else if (buttonIndex == 2)
{
Egarageselling *object=[[Egarageselling alloc]initWithNibName:@"Egarageselling" bundle:nil];
[self presentModalViewController:object animated:YES];
[object release];
}
else if (buttonIndex == 3)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scrap" message:@"Do you want to Scrap"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
else if (buttonIndex == 4)
{
}
else if (buttonIndex == 5)
{
}
else if (buttonIndex == 6)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scrap" message:@"Do you want to Scrap"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
else if (buttonIndex == 7)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scrap" message:@"Do you want to Scrap"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
else if (buttonIndex == 8)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scrap" message:@"Do you want to Scrap"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
else if (buttonIndex == 9)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Scrap" message:@"Do you want to Scrap"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
[alert release];
}
}
How to solve this problem.
Set different tags for two actionsheets like
popupQuery.tag=5;
popupQuery.tag=6;