基于答案here ,我可以看到 UITextField 上存在一个名为 editable 的属性。但是当我尝试自己设置它时,出现错误 Property 'editable' not found on object of type 'UITextField *'
。怎么了?还是有另一种方法使 UITextField 不可编辑?谢谢。
UITextField *result = [[UITextField alloc] init];
result.editable = NO; // error here
最佳答案
尝试
textfield.enabled = false;
或者设置textfield
的委托(delegate)
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
return false;
}
关于ios - 在 'editable' 类型的对象上找不到属性 'UITextField *',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34803323/