文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > 动态调整UITableViewCell高度的实现方法
侵权投诉

动态调整UITableViewCell高度的实现方法

动态调整UITableViewCell高度的实现方法

动态调整UITableViewCell高度的实现方法

本文转自 doc.guandang.net动态调整UITableViewCell高度

的实现方法

有时我们需要动态调整UITableViewCell的高度,根据内容的不同设置不同的高度,以前看到一种实现方法,写得有点麻烦,具体地址找不到了,这里有个更好的(至少我认为),分享一下部分代码。

- (UITableViewCell *)tableView:(UITableView *)tableView

cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; label.tag = 1;

label.lineBreakMode = UILineBreakModeWordWrap; label.highlightedTextColor = [UIColor whiteColor];

label.numberOfLines = 0; label.opaque = NO; // 选中Opaque表示视图后面的任何内容都不应该绘制 label.backgroundColor =

[UIColor clearColor]; [cell.contentView addSubview:label]; [label release]; } UILabel *label = (UILabel *)[cell viewWithTag:1]; NSString *text; text = [textArray

objectAtIndex:indexPath.row]; CGRect cellFrame = [cell frame];

第1页

你可能喜欢

  • iphone开发
  • 海运提单
  • iOS开发
  • Objective-C
  • 无线模块
  • 即时通信

热门文档

相关文档

  • UITableView(cell)行高——根据文件内容自动设置

    UITableView(cell)行高——根据文件内容自动设置_计算机...在程序开发中,很多数据是动态获取的,通常UITableView...‘…’ 如果需要 , 程序要求完全实现数据内容,则...

  • UITableView 系列五 :自定义UITableViewCell (实例)

    UITableView 系列五 :自定义UITableViewCell (实例)_其它考试_资格考试/认证_教育专区。UITableView 系列五: 自定义 UITableViewCell (实例)有时候我们需要自己定义 UIT...

  • UITableView使用方法

    3. 然后就可以实现这些 delegate 的一些方法拉。 (1)- (NSInteger)numberOf...(4)- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtInd...

  • UITableView详解

    doesn't track } UITableViewCellAccessoryType //是否加换行线 typedef enum {...利用UITableView实现对图... 4页 免费 UITableView 基本使用方... 暂无评价 14...

  • 自定义UITableViewCell

    自定义UITableViewCell_计算机软件及应用_IT/计算机_专业资料。iOS自定义UITableView...cell 配置的步骤和上面一样, 主要区别在于需要自己自定义控件来是实现 cell。 ...

  • IOS小汇

    iOS-动态调整 UITableViewCell 的高度 对于图表来说能够动态调整高度是件很有意义的...要实现它需要调用 -cellForRowAtIndexPath,大致内容如下所示: 1 2 3 4 5 6...

  • iphone开发基础第八章

    表视图是显示表数据的视图对象,它是UITableView类的一个实例。表中的每个可见行都由 UITableViewCell类实现。因此,表视图是显示表中可见部分的对象,表视图单元负责...

  • UITableView详解

    优化UITableView性能 4页 免费 利用UITableView实现对图... 4页 免费 UITableView...[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:...

  • UITableView.iOS笔记(20)_萧宸宇

    (Google一个栗子吧,写不动了) 插一句,Cell的重用是需要下面这样的实现方法 1 2 3 4 5 6 7 8 9 - (UITableViewCell *)tableView:(UITableView *)tableView...

  • IOS学习之UITableView中Cell的操作

    实现删除的代码: [cpp] view plaincopy 1. - (void)tableView:(UITableView *)tableView commitEditingStyle: 2. (UITableViewCellEditingStyle)editingStyle ...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email