2012-06-20 27 views
4

是否有任何方式顯示登錄/密碼文本字段UIAlertView,以便鍵盤類型是UIKeyboardTypeEmailAddress結合UIAlertViewStyleLoginAndPasswordInput與UIKeyboardTypeEmailAddress

我使用UIAlertView如下:

var alertView = new UIAlertView("Login".Translate(), "", null, "Cancel".Translate(), "Login".Translate()); 
alertView.AlertViewStyle = UIAlertViewStyle.LoginAndPasswordInput; 

,或者在Objective-C:

UIAlertView *alertView = [[UIAlertView alloc] 
          initWithTitle:@"Title" 
          message:@"Message" 
          delegate:self 
          cancelButtonTitle:@"Cancel" 
          otherButtonTitles:@"Login", nil]; 
[alertView setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput]; 

,但我的應用程序的所有用戶名是電子郵件地址,所以我想將登錄文本字段的鍵盤作爲電子郵件地址鍵盤,即UIKeyboardTypeEmailAddress

任何想法?

回答

8

明白了。你可以得到UIAlertView的文本框,並設置有風格:

alertView.GetTextField(0).KeyboardType = UIKeyboardType.EmailAddress; 

的OBJ-C:

[[alertView textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeEmailAddress];