1
A
回答
0
無法修改標準數字鍵盤。典型的解決方案是使用按鈕設置工具欄,並使該視圖成爲文本字段的inputAccessoryView
。點擊按鈕後,您可以在文本框中調用resignFirstResponder
。
2
你可以這樣做,你可以設置你自己的工具欄的位置。
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if(textField == yourTextField)
{
UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.barStyle = UIBarStyleBlackTranslucent;
numberToolbar.items = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(doneButton)],nil];
textField.inputAccessoryView = numberToolbar;
}
}
- (void)doneButton
{
[youtTextField resignFirstResponder];
}
相關問題
- 1. 返回鍵盤iOS Textfield
- 2. iOS檢查JSON返回是否有鍵
- 3. 處理數字鍵盤的藍牙鍵盤的返回鍵
- 4. 數字鍵盤鍵盤不顯示返回鍵中的iPhone
- 5. 設置Android鍵盤上的返回鍵
- 6. 是否有返回上一個滾動位置的鍵盤快捷鍵?
- 7. iPhone鍵盤鍵值返回
- 8. UISearchBar鍵盤返回鍵
- 9. 鍵盤輸入返回鍵
- 10. iPhone鍵盤返回鍵
- 11. iOS 11 - 鍵盤高度在鍵盤通知中返回0
- 12. 鍵盤擴展:是否有可能從iOS iOS鍵盤繼承功能和UI?
- 13. 帶有「Go」按鈕而不是返回的iOS鍵盤
- 14. Error Insight是否有鍵盤快捷鍵?
- 15. Perl Tk綁定<Return>是不是數字鍵盤返回?
- 16. iOS 8自定義鍵盤防止關閉返回鍵
- 17. 如何在xcode中啓用ios鍵盤返回鍵功能?
- 18. 映射數字鍵盤上的鍵
- 19. Python:按下鍵盤按鍵並返回
- 20. iPhone鍵盤返回鍵顏色
- 21. 如何實現iOS鍵盤數字鍵盤?
- 22. 在設置包中關閉鍵盤/數字鍵盤iOS
- 23. iOS 10.0 Beta,鍵盤擴展:消失的數字鍵盤(iPhone)
- 24. iOS鍵盤代表回調函數
- 25. 突出顯示iOS鍵盤上的「返回」按鈕
- 26. 如何處理iOS網頁視圖本機鍵盤上的返回鍵?
- 27. 在PhoneGap的數字鍵盤上啓用回車鍵
- 28. 軟鍵盤 - 數字只有
- 29. Titanium - iOS上的createAlertDialog,帶有數字鍵盤的secure_text_input?
- 30. <input type =「number」/>沒有在iOS上顯示數字鍵盤
@maddy工具欄顯示哪裏?我一直在使用pickerview作爲另一個項目中的inputAccessoryView,並且pickerview顯示的不是textview的鍵盤。但我不需要帶按鈕而不是鍵盤的工具欄,我需要兩個顯示。你有沒有嘗試過? – mrd
我想你的意思是你一直在使用'UIPickerView'作爲'inputView'。 'inputAccessoryView'顯示在鍵盤的頂部(或'inputView')。 – rmaddy
對,我的錯,它是'inputView'。我一直在尋找我在互聯網上找到的一些例子,它們包含大量的代碼,只在數字鍵盤上顯示返回鍵。你有鏈接到一個簡短的例子嗎? – mrd