I require an input prompt in my app and I've tried this
// Create a new item
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New item" message:@"Enter a name for the item" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];
And then handling it like this:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
// The user created a new item, add it
if (buttonIndex == 1) {
// Get the input text
NSString *newItem = [[alertView textFieldAtIndex:0] text];
}
}
but it doesn't look like the clickedButtonAtIndex gets called, why?
Kind Regards, Erik