@implementation
UIAlertView *query;
@end
- (void)viewWillAppear:(BOOL)animated {
query = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"New", @"")
message:nil
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:NSLocalizedString(@"OK", @""), nil];
query.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField *textField = [_query textFieldAtIndex:0];
textField.placeholder = NSLocalizedString(@"Title", @"placeholder text where user enters name for new playlist");
textField.delegate = self;
[_query show];
}
顯示鍵盤UIAlertView
顯示後,鍵盤也顯示並UITextfield
是焦點(這只是工作預iOS7,但在iOS8上不工作)。我試過[textfield becomeFirstResponder]
,但它不起作用。我創建新項目並使用上面的海灣,它的工作原理。UIAlertView中的文本框不iOS8上
我的問題:鍵盤不顯示UIAlertViewStylePlainTextInput
風格。
我不知道爲什麼?任何人都可以幫助我嗎? 謝謝。
謝謝你的時間。使用GM xCode發佈版本時,首次顯示UIAlertView但鍵盤不顯示。第二次和以後,它總是顯示鍵盤。我認爲這是Apple的一個漏洞。我會嘗試像你的建議。再一次,謝謝。 – nmh 2014-09-17 03:09:32
非常感謝:) – sum2000 2015-01-28 16:33:43