0

UITextField を取得しました。ユーザーが UITextField に何も入力しない場合は、UIAlertView を送信したいと考えています。

4

1 に答える 1

1

最初に入力をキャプチャします。

NSString *text = myTextField.text;

次に、null 文字列をテストし、alertview を提示します。

if (title == [NSNull null] || title.length == 0 ) {

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:button1 otherButtonTitles:button2, nil];
    [alertView show];
}
于 2010-06-20T15:08:53.710 に答える