を失敗私はのUITextFieldを持っていると私はそうのようにそれを作成します。UITextFeld比較
firstnameField1 = [[UITextField alloc] initWithFrame:CGRectMake(85+320*4, 80, 150, 30)];
[firstnameField1 setBorderStyle:UITextBorderStyleRoundedRect];
[firstnameField1 setPlaceholder:@"Firstname"];
[firstnameField1 setDelegate:self];
[firstnameField1 setReturnKeyType:UIReturnKeyNext];
[scrollViewController addSubview:firstnameField1];
ユーザーが、私はその空の場合は、テキストフィールドは、それに入力された何かを持っているかどうかを確認したい、リターンキーをタップ、ユーザーは何も入力していないので、私は戻って、どこにも見えるように、フィールドが満たされていなければならないことをユーザーに伝えるラベルを表示します。
私がチェックするために次の手順を実行します
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
//Check if the user has typed anything
if (textField.text == @"") {
//If not, show 'required' labels
[firstNameRequiredLbl1 setAlpha:1];
[surnameRequiredLbl1 setAlpha:1];
[firstNameRequiredLbl2 setAlpha:1];
[surnameRequiredLbl2 setAlpha:1];
return YES;
}
//Do all my other stuff, cut out for ease of reading, 100% doesn't affect this anyway
return YES;
}
私はその最後のメソッドにブレークポイントを設定して、それは私がそのテキストフィールドに入力するか、if文かどうかという権利過去をジャンプします。
アイデア?ありがとう。