gpt4 book ai didi

iphone - textField.clearButtonMode =/* 不管怎样 */不起作用

转载 作者:可可西里 更新时间:2023-11-01 05:10:52 24 4
gpt4 key购买 nike

我正在创建一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com