2012-11-19 28 views
1

我無法從UIPopover中關閉鍵盤。當我運行這個ResignFirstResponder()函數時,我在popover窗體中有文本字段。不知道爲什麼有任何想法。它只在我從popover運行時發生。無法在單點觸控中關閉UIPopover的鍵盤

是因爲它覆蓋和對象。需要幫忙?我的代碼如下: 這裏我叫popover;

  if (this.CustomerID != 0) { 
       var content = new BillingAddressViewController (this, this.CustomerBillingAddress); 
       content.CustomerID = this.CustomerID; 
       content.rootcontroller = this; 
       DetailViewPopover = new UIPopoverController (content); 
       DetailViewPopover.PopoverContentSize = new SizeF (300, 200); 
       DetailViewPopover.PresentFromRect (this.customerBillingAddressCell.Frame, View, UIPopoverArrowDirection.Any, true); 
      } else { 
       var x = new UIAlertView ("Notifcation Message", "Please choose customer to proceed with Billing Address", null, "OK"); 
       x.Show(); 
      } 

     }; 

內酥料餅的內容類的,我呼籲按鍵觸發

this.billingTextView.ResignFirstResponder(); 

;

回答

0

在您的DissmisskeyBoard方法中使用以下代碼。

[self.view endEditing:YES]; 

希望它能幫助你。

- (BOOL)textFieldShouldReturn:(UITextField *)textField { 
[self.view endEditing:YES]; 
return YES; 
} 
+0

它不工作我試過這個 – Akrambek

+0

它是複製任何東西。我已經在rootview和popover視圖中調用了這個函數, – Akrambek

+0

是否在.h文件中使用了** UITextfieldDelegate **,在.m文件中使用了** textfield.delegate = self **? –