[英]UITableViewCell and UITextField with user interaction disabled doesn't call didSelectRow
[英]User can tab to a UITextField that has user interaction disabled
我在UITextField中禁用了用戶交互:
textField.isUserInteractionEnabled = false
仍然(至少在模擬器中)用戶可以跳至該字段並輸入數據。 要解決此問題,我必須在UITextFieldDelegate中執行以下操作:
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
// This seems really odd.
return isUserInteractionEnabled
}
UITextField中的錯誤? 還是預期的行為? (這是在Xcode 9.4.1下運行的iOS 11.4。)
嘗試設置textField.enabled = false。
這是UIView上UIControl接口的屬性。
從UIControl.h注釋:如果為NO,則忽略觸摸事件,並且子類的繪制方式可能有所不同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.