2011-10-29 8 views
11

テキスト入力の新しいUIAlertViewに自動資本化オプションを設定する方法はありますか?
私は、これは大文字で始めたい:UIAlertViewのUITextFieldで自動キャッシュを設定するには?

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Add Name" message:@"Enter name for routine" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil]; 
    [alert setAlertViewStyle:UIAlertViewStylePlainTextInput]; 
    [alert show]; 

答えて

40
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Add Name" message:@"Enter name for routine" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil]; 
[alert setAlertViewStyle:UIAlertViewStylePlainTextInput]; 
[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeSentences; 
[alert show]; 
2

あなたの好みに応じて3つのタイプがあります。

最初は、各単語の最初の文字を大文字にすることである。

[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeWords; 

第二は、すべての単語

[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; 

第三の文

内のすべての単語を大文字にすることを活用することです
[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeSentences; 
関連する問題