views:

26

answers:

1

Hi,

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

+2  A: 

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;

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:

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.

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).

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

Akusete