2009-02-10 109 views
1

我想使用警報視圖接受密碼。以下是我正在使用的代碼。但我無法弄清楚爲什麼鍵盤彈出兩次而不是一次?有任何想法嗎?UIAlertView中的iPhone鍵盤彈出問題

UIAlertView *passwordAlert = [[UIAlertView alloc] 
     initWithTitle:@"Enter Password" message:@"" 
     delegate:self cancelButtonTitle:@"Cancel"   
     otherButtonTitles:@"Submit",nil]; 

[passwordAlert addTextFieldWithValue:@"" label:@"Password"]; 

UITextField *textfield = [passwordAlert textFieldAtIndex:0]; 
textfield.secureTextEntry = YES; 
[passwordAlert setTag:10]; 
[passwordAlert show]; 

回答

0

不能完全確定,其中addTextFieldWithValue定義,但你可能要檢查你的.xib文件,以確保你沒有放置在「舞臺」雙意見在這篇文章:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/1479-uialertview-popping-up-twice.html

此外,看看這個職位。看起來你可能不得不「顯示警報視圖之前告訴文本字段,成爲第一個響應者,你會風與兩個鍵盤」:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/2753-new-info-adding-text-fields-alerts.html#post14701

+0

感謝的人,是工作..! :-) – Neo 2009-02-10 12:12:58