[英]hiding the keypad on iphone
我有一個看起來像下面的表格(見圖)。 如果用戶點擊“登錄”按鈕,我希望鍵盤消失。 我怎么做。
請注意,由於用戶只是點擊UIButton(登錄),因此不會調用TextFieldDelegate方法。 因此,我可以在IBAction中為此按鈕添加任何內容嗎?
通常,當用戶點擊文本字段之外的某個位置時,鍵盤應自動關閉,但您也可以使用手動隱藏它
[textField resignFirstResponder]
set delegate for your text field <UITextFieldDelegate>
and over ride this method
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.