@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
因需要在表格中显示不定长数据,在网上找了下基本没有好的解决办法。自己弄了下可以实现所需功能,仍不完美!
@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
具体实现方法:
1.利用 size=[[tempArray objectAtIndex:i] sizeWithFont:[UIFont systemFontOfSize:12.0] constrainedToSize:CGSizeMake(100.0f, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
方法得到字符串的高度
2.加入UILabel子视图
UILabel *labelDes=[[UILabel alloc] initWithFrame:CGRectMake(120,10, 175, height+5.0f)];
labelDes.font=[UIFont systemFontOfSize:12];
labelDes.textAlignment=UITextAlignmentLeft;
labelDes.text=[stringArray objectAtIndex:indexPath.row];
labelDes.numberOfLines=(int)[rowArray objectAtIndex:indexPath.row];
[cell.contentView addSubview:labelDes];
[labelDes release];