1
喜的朋友,我现在如果我用这个代码将打印标签上的多个值,但在新的生产线我不希望像如何在的UILabel打印多值水平在iPhone
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGSize labelSize = CGSizeMake(200.0, 20.0);
if ([displayTag length] > 0)
labelSize = [displayTag sizeWithFont: [UIFont boldSystemFontOfSize: 17.0] constrainedToSize: CGSizeMake(labelSize.width, 1000) lineBreakMode: UILineBreakModeWordWrap];
return 24.0 + labelSize.height;
}
return 40.0;
}
这段代码将打印垂直线但我想标签上水平打印我的价值如何标签上水平给多值打印在特定的细胞
的,我是创造,但不工作 我哪里错了 这个代码在我的自定义单元格
TagsLable= [[UILabel alloc]initWithFrame:CGRectMake(360, 15, 150, 21)];
TagsLable.font = [UIFont fontWithName:@"Verdana" size:16.0f];
TagsLable.textAlignment=UITextAlignmentRight;
TagsLable.backgroundColor=[UIColor clearColor];
CGSize fontSize = [tagList sizeWithFont: [UIFont boldSystemFontOfSize: 17.0]];
double finalWidth = fontSize.width * UIBaselineAdjustmentAlignBaselines;
//double finalWidth = fontSize.width + self.numberOfLines;
double finalHeight = self.frame.size.height; //expected height of label
CGSize theStringSize = [tagList sizeWithFont: [UIFont boldSystemFontOfSize: 17.0] constrainedToSize:CGSizeMake(finalWidth, finalHeight) lineBreakMode: UILineBreakModeWordWrap];
int newLinesToPad = (finalWidth - theStringSize.width)/fontSize.width;
for(int i=0; i<newLinesToPad; i++)
{
//tagList = [tagList stringByAppendingString:@","];
tagList=[tagList stringByAppendingFormat:@"%@, ",tag.TagName];
}
“multipla” ????你的意思是什么?多重还是多重? – HarshIT 2012-03-29 06:52:08
我的意思是多个值应显示在标签请说如何做 – Rocky 2012-03-29 07:06:07
问题不明确。你能张贴你需要的照片吗? – Gargo 2012-03-29 07:57:13