これはあなたを助けるはずです:)
NSString *str=self.strQuestionTitle;
CGRect rect=CGRectMake(51, 16, 257, 0);
CGSize size=[str sizeWithFont:self.lblQuestion.font constrainedToSize:CGSizeMake(257, 3000) lineBreakMode:self.lblQuestion.lineBreakMode];
int lines=(size.height/self.lblQuestion.font.pointSize);
self.lblQuestion.numberOfLines=lines;
rect.size=size;
if(lines>2)
{
if(lines==3 &&[str length]>66)
{
str=[str substringToIndex:66];
str=[str stringByAppendingString:@"...Read More"];
size=[str sizeWithFont:self.lblQuestion.font constrainedToSize:CGSizeMake(257, 67) lineBreakMode:self.lblQuestion.lineBreakMode];
int lines=(size.height/self.lblQuestion.font.pointSize);
self.lblQuestion.numberOfLines=lines;
rect.size=CGSizeMake(257, 67);
}
else if(lines>3)
{
str=[str stringByAppendingString:@"...Read More"];
size=[str sizeWithFont:self.lblQuestion.font constrainedToSize:CGSizeMake(257, 67) lineBreakMode:self.lblQuestion.lineBreakMode
];
int lines=(size.height/self.lblQuestion.font.pointSize);
self.lblQuestion.numberOfLines=lines;
rect.size=CGSizeMake(257, 67);
}
//self.lblQuestion.lineBreakMode=NSLineBreakByTruncatingHead;
}