注意:要设置uilabel的行数为:不限制行数
设置该字典大小的时候注意:前后的字体的大小都要设置,而且要保持一致。
NSDictionary *dictAttribute = @{NSFontAttributeName:[UIFontsystemFontOfSize:14]};
CGSize size= [self.filteredCities[indexPath.row]boundingRectWithSize:CGSizeMake(self.view.frame.size.width,40) options:NSStringDrawingTruncatesLastVisibleLine |NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dictAttributecontext:nil].size;
CGRect frame1 = self.lbTitle.frame;
frame1.size = size;
self.lbTitle.frame = frame1;
self.lbTitle.text =self.filteredCities[indexPath.row];