我想在 UILabel 中显示前 500 个字符,如果有超过 500 个字符可用,则显示截断图标。但我不知道如何限制 500 个字符来截断文本?
这是我的代码
label2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 350, self.bounds.size.width, 30)];
// In this case value of self.bounds.size.width is "427"
label2.backgroundColor = [UIColor clearColor];
label2.numberOfLines = 2;
label2.textAlignment = UITextAlignmentCenter;
label2.font = [UIFont systemFontOfSize:13];
[self addSubview:label2]
//Here is Implimentation code of my label
NSString *temp = [galleryEntryTree objectForKey:@"description"];// calling lebel text from database
coverView.label2.text = temp;
coverView.label2.adjustsFontSizeToFitWidth = NO;
coverView.label2.lineBreakMode = UILineBreakModeTailTruncation;
告诉我,我怎样才能显示最少 500 个字符而不是截断它(如果超过 500 个)
任何帮助表示赞赏