无法动态删除UITextField的边框 [英] Cannot remove border of UITextField dynamically

查看:101
本文介绍了无法动态删除UITextField的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想动态删除UITextField的边框。

I want to remove the border of UITextField dynamically.

我试过 [stringTextField setBorderStyle:UITextBorderStyleNone];

但没有任何反应。有什么想法?

but nothing happened. Any idea?

推荐答案

TextField 是否已在视图中显示有时候是这样的?如果是这样,你(可能)需要执行以下操作:

Is the TextField already displayed in the view when this happens? If so, you (probably) need to execute the following:

[stringTextField setBorderStyle:UITextBorderStyleNone];
[stringTextField setNeedsDisplay];

为了让视图重绘 TextField ,没有边界。请注意,无法保证系统会立即重绘 textField 。您正在向系统指示您希望重绘该字段。

in order for the view to redraw the TextField, sans border. Note that there's no guarantee the system will immediately redraw the textField. You're indicating to the system that you'd like the field to be redrawn.

这篇关于无法动态删除UITextField的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆