我想做一个简单的 alertView 并询问电话号码...
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"What is your phone number?"
message:nil
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Continue", nil];
message.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField* answerField = [message textFieldAtIndex:0];
answerField.keyboardType = UIKeyboardTypeNumberPad;
answerField.placeholder = @"+43 ...";
[message show];
我必须在这里输入什么来检查带有数字的东西(比如 Mysql 等)
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
UITextField *textField = [alertView textFieldAtIndex:0];
?????????
// Something like if (textField == "090012345678") -> NSLog(@"WOW"); ...
}