問題があります。
私は4つのテキストフィールドを持っていますが、入力フィールドのテキストフィールドをチェックする方法はわかりません。
ユーザー入力時にtextFiled入力文字列をチェックする方法
nameField
は10弦の上にageField
小切手か数かsexField
チェック男性または女性
ですこれは私のコードではありません。
- (IBAction)addComment:(id)sender {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Commend" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Please input your name:";
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Please input your age:";
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Please input your sex:";
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Please input your commend:";
}];
UIAlertAction *sendAction = [UIAlertAction actionWithTitle:@"send" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
UITextField *nameField = alertController.textFields[0];
UITextField *ageField = alertController.textFields[1];
UITextField *sexField = alertController.textFields[2];
UITextField *commentField = alertController.textFields[3];
UIAlertController *successAlertController = [UIAlertController alertControllerWithTitle:@"Alert" message:@"Success" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self.navigationController popViewControllerAnimated:YES];
}];
[successAlertController addAction:okAction];
[self presentViewController:successAlertController animated:YES completion:nil];
}];
[alertController addAction:sendAction];
[self presentViewController:alertController animated:YES completion:nil];
}
ありがとう!
でJSInputFieldを使用してみてくださいを確認することができますか?または、送信ボタンを押した後に? –
男性または女性を確認するには –
年齢と性別のフィールドでピッカーを使用しない理由 – sanjeet