UILabelに最初の500文字を表示し、500文字を超える文字がある場合は切り捨てアイコンを表示したいと思います。テキストを切り捨てますか?ここで UILabelを500文字に制限し、IOSlabelを切り捨てます
は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があれば)
coverView.label2.lineBreakMode = UILineBreakModeWordWrap;高さを調整するか、高さを動的に増やします。 –
NSMutableStringを使用してテキストを切り捨てて、label.textを設定する前に – jcesarmobile
yourLabel.text.lengthをifで使用し、stringbyappendingstringまたはstringwithformatを使用してください。 – amar