簡體   English   中英

在UIwebview的uipopover上替換文本字段的鍵盤

[英]Replace textfield's keyboard on uipopover in UIwebview

我有帶有textfields HTML頁面,並且在UIWebView觸摸此文本textfield中的任何一個之后,我需要向UIPopOver顯示靜態信息並隱藏鍵盤。 我該怎么做?

將文本字段的inputview設置為nil。

textField.inputView = nil;

將此代碼放在您的viewDidLoad方法中,這是在顯示鍵盤時通知您的通知

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow) name:UIKeyboardDidShowNotification object:nil];

通過以下通知方法在UITextField中添加彈出視圖

- (void)keyboardDidShow
{
       if(self.myTextFieldName)
        {
          [myTextFieldName resignFirstResponder]; /// resignFirstResponder/hideKeyBoard when you click on UITextFiled 
          myTextFieldName.inputView = self.PopUpView. // and add your popup view as input view of yourTextFiled         
        }

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM