Hi, I'm trying to test out some action sheet skills and I can't figure out why this isnt working. I'm trying to get the title of the action sheet button to simply post in a UITextField. here are my actions:
---------and then this -------------
I modified the controller header file to include the UIActionSheetDelegate protocol as well. So I'm not sure why nothing happens when you click the button.
any help greatly appreciated!! thanks
Code:
-(IBAction)doActionSheet:(id)sender {
UIActionSheet *actionSheet;
actionSheet=[[UIActionSheet alloc]initWithTitle:@"Available Actions"
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destroy"
otherButtonTitles:@"Negotiate", @"Compromise", nil];
[actionSheet showInView:self.view];
}
---------and then this -------------
Code:
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *buttonTitle=[actionSheet buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"Destroy"]) {
userOutput.text=@"Destroy";
} else if ([buttonTitle isEqualToString:@"Negotiate"]) {
userOutput.text=@"Negotiate";
} else if ([buttonTitle isEqualToString:@"Compromise"]) {
userOutput.text=@"Compromise";
} else {
userOutput.text=@"Cancel";
}
}
I modified the controller header file to include the UIActionSheetDelegate protocol as well. So I'm not sure why nothing happens when you click the button.
any help greatly appreciated!! thanks
Last edited by a moderator: