headsky

IOS表格任意多行显示

@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,10175, 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];

posted on 2011-11-18 17:44 张天祖 阅读(840) 评论(0)  编辑 收藏 引用 所属分类: IOS


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

统计

常用链接

留言簿

随笔分类

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜