如何删除 uilabelview 文本在 iphone 末尾附加三个点
我有一个 UILabel,它附加了 UILabel。我向其中添加 NSString 值,每次在文本结束后为每个单元格添加三个点到文本文件的末尾。 我不知道为什么我会得到这个。有没有人遇到过类似的问题: 在这里我定义了我的 UILabel:
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 15, 15)];
// set the label
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont boldSystemFontOfSize:14];
label1.adjustsFontSizeToFitWidth = NO;
self.labelView1 = label1;
[self.contentView addSubview:label1];
[label1 release];
并添加了如下文本。
labelView1.text = title;
labelView1.adjustsFontSizeToFitWidth = NO;
I have a UILabel which has UILabel attached to it. I add NSString value to it and each time for each cell after the text is over, it appends three dots to the end of the text file.
I am not sure why would I get that. Does any body have faced the similar problems:
Here I define my UILabel:
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 15, 15)];
// set the label
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont boldSystemFontOfSize:14];
label1.adjustsFontSizeToFitWidth = NO;
self.labelView1 = label1;
[self.contentView addSubview:label1];
[label1 release];
And I add the text as following.
labelView1.text = title;
labelView1.adjustsFontSizeToFitWidth = NO;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不希望标签在字符串不适合标签大小时附加“...”,请将标签的
lineBreakMode
属性设置为 UILineBreakModeClip:If you don't want the label to append '...' when string does not fit label's size set label's
lineBreakMode
property to UILineBreakModeClip:问题是文本太长,无法容纳标签,并且您已调用
,这意味着文本不会缩小以适应标签。
如果宽度为
15
,则几乎无法容纳14
字体大小的一个字母。使标签更大或尺寸适合(或两者)。The problem is that the text is too long to fit the label and you've called
which means the text will not be scaled down to fit.
With a width of
15
, you can barely fit one letter of font size14
. Make the label bigger or size to fit (or both).