UITextFieldViewModeAlways

UITextFieldViewModeAlways

本文介绍了UITextField 清除按钮不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想始终在 UITextField 中显示一个清除按钮.我试图在 .xib Interface Builder 中设置它:并在代码中使用这一行:[_firstNameField setClearButtonMode:UITextFieldViewModeAlways];

I want to show a clear button always in a UITextField. I have tried to both set this in .xib Interface Builder:and in code using this line: [_firstNameField setClearButtonMode:UITextFieldViewModeAlways];

两者都不会导致按钮显示.请帮忙.

Neither causes the button to show. Help please.

推荐答案

当您将其设置为 UITextFieldViewModeAlways 时,只要 UITextField 上有文本,就会出现清除按钮.

When you set it to UITextFieldViewModeAlways the clear button appears as long as there is text on the UITextField.

希望这会有所帮助!

这篇关于UITextField 清除按钮不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:06