如何避免uitextfield旁边的点 [英] how to avoid dots next to a uitextfield

查看:53
本文介绍了如何避免uitextfield旁边的点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当文本大于uitextfield的宽度时,是否可以删除uitextfield旁边显示的点.

Is that possible to remove the dots which are displayed next to uitextfield when text is larger than the width of the uitextfield.

推荐答案

有一个属性lineBreakMode,用于定义当要显示的文本大于控件框时的行为

There is a property lineBreakMode which defines the behaviour when the text to be displayed is larger than the box of the control

//UILineBreakMode
//Options for wrapping and truncating text.

typedef enum {
 UILineBreakModeWordWrap = 0,
 UILineBreakModeCharacterWrap,
 UILineBreakModeClip,
 UILineBreakModeHeadTruncation,
 UILineBreakModeTailTruncation,
 UILineBreakModeMiddleTruncation,
} UILineBreakMode;

如果您不希望有任何点,可以使用 UILineBreakModeClip ,该方法会在末尾截断文本.苹果医生说:

If you do not want any dots you can use UILineBreakModeClip which simply cuts the text off at the end. The apple doc says this:

到达绘图矩形的末端时,请剪切文本.此选项可能会导致在字符串末尾部分渲染字符. 在iPhone OS 2.0和更高版本中可用.

Clip the text when the end of the drawing rectangle is reached. This option could result in a partially rendered character at the end of a string. Available in iPhone OS 2.0 and later.

尽管这当然取决于您要如何显示文本.由于无论哪种方式都无法显示所有文本,因此点通常比原始中断更具美感.

Although it of course depends on how you want to display the text. Since either way you cannot display all of the text the dots are usually more asthetic than a raw break.

如果您要求绝对显示所有文本,则必须扩展字段的 width height (并使用 UILineBreakModeCharacterWrap strong>),或可能会减小字体大小(作为最后的选择).

If you require absolutely all of the text to be visible you must either expand the width of the field, or the height (and use UILineBreakModeCharacterWrap), or possibly decrease the font size (as a last resort).

通过Google对该主题进行快速搜索,使该如何使UILabel/UITableViewCell具有动态高度

A quick google search on the subject pulled this How to make UILabel / UITableViewCell to have a dynamic height

这篇关于如何避免uitextfield旁边的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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