views:

7

answers:

0

I have multiple action sheets in a view. I use the following code to get them to do an action but it seems to only work for the 1st button, not any of the other buttons. How can I get it to work with the 2nd and 3rd button, etc.?

Here's the code:

 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
 if(actionSheet == actionsheet1) {
  UIImageWriteToSavedPhotosAlbum(ball.image, nil, nil, nil);
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Image Saved" message:@"The Wallpaper was successfully saved to the Photos app" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
  [alert show];
  [alert release];
 } else if(actionSheet == actionsheet2) {
  UIImageWriteToSavedPhotosAlbum(ball.image, nil, nil, nil);
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Image Saved" message:@"The Wallpaper was successfully saved to the Photos app" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
  [alert show];
  [alert release];

 }}