2011-10-29 3 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

는 기본 설정에 따라 세 가지 유형이 있습니다.

첫 번째는 각 단어의 첫 글자를 활용하는 것입니다

[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeWords; 

두 번째는

[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; 

세 번째 문장의 모든 단어를 대문자로하는 모든 단어를 활용하는 것입니다

[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeSentences; 
관련 문제