- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在创建一个 textField 并将其添加到这样的 View 中:
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(/*blah blah */)];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.clearButtonMode = UITextFieldViewModeAlways;
[otherView addSubview:textField];
文本字段在 otherView
中按预期呈现,但无论我为 clearButton 分配什么值,清除按钮都不会呈现。任何人都知道这可能是什么原因造成的?
最佳答案
答案是 UITextField.clearButtonMode
有效。当文本字段有值时,按钮就在那里。我想我假设“Always”的意思是“Always”,但实际上它的意思是“当 .text != nil
”时。
关于iphone - textField.clearButtonMode =/* 不管怎样 */不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4810047/
我可以更改文本字段上 clearButtonMode 的颜色吗? theTextField.clearButtonMode = UITextFieldViewModeWhileEditing 显示一个
我有一个扩展的 UITextField(添加了一个 NSString 属性,inputType)来接收用户输入。当用户点击文本字段时,我使用一个选择器供用户选择输入。我还需要允许用户清除文本框,所以我
我希望 X 按钮仅在以下情况下显示 textField.clearButtonMode = .UnlessEditing 当用户按下 X 按钮时,textView 成为第一响应者,键盘弹出。 我该怎么
我正在创建一个 textField 并将其添加到这样的 View 中: UITextField *textField = [[UITextField alloc] initWithFrame:CGRe
是否可以在 Interface Builder 中为 UITextField 设置clearButtonMode?难道只有写代码才可以吗?我没有将其视为 UITextField 属性面板中的选项。 最
应该如何实现“X”来清除 native react 中的按钮,以便它适用于 Android 和 iOS。 iOS 有“clearButtonMode” enum('never', 'while-edi
我是一名优秀的程序员,十分优秀!