2009-02-10 106 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