iPhone开发笔记 (4) 如何改变UITableViewCell的行高
2012-02-26 16:05
501 查看
在使用UITableView的时候,UITableViewCell的高度可能要改变。改变行高有两种情况,第一种是改变所有的行高。第二种是改变特定行的行高。
第一种,改变所有行的行高。就是类似下面的效果。
这里要使用UITableViewDelegate的方法:
只要对上面的方法做一下修改如下:
第一种,改变所有行的行高。就是类似下面的效果。
这里要使用UITableViewDelegate的方法:
//设置rowHeight - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 91.5; }第二种,如果要指定改变某个行的行高。就类似下面的效果。
只要对上面的方法做一下修改如下:
//设置rowHeight - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0 && indexPath.row == 0) { return 220; } else { return 40; } }
相关文章推荐
- ios开发笔记:如何在iphone/ipad应用程序添加iAd
- ios开发笔记如何在iphone-and-ipad应用程序添加admob
- IOS开发笔记-发布iphone/ipad应用程序被拒绝,如何解决
- ios开发笔记之如何让tableView根据文本内容动态改变cell的高度
- [iphone 开发学习笔记]Object-C和C语言最大的区别也是最大的扩展-----消息(即如何调用一个对象中的函数)
- iPhone开发学习笔记003——UITableViewCell内容自适应高度
- iPhone开发学习笔记003——UITableViewCell内容自适应高度
- IPhone开发学习笔记:属性变量如何release?
- iphone开发笔记:地图注解(地图上的大头针)
- MFC笔记:如何移动控件位置,改变控件大小等
- C#里WinForm开发中如何实现控件随窗体大小的改变而自动适应其改变
- iOS开发_iphone开发_文件系统NSFileManager_如何创建、重命名和删除文件
- iphone 开发笔记二
- iphone开发会给我们的生活带来不一样的改变
- iphone 开发学习笔记四
- 如何开发你的第一款iPhone应用?
- iphone开发--改变UIPageControl里的小点的颜色
- 详解iPhone开发应用中如何使用Web视图
- iPhone开发学习笔记_剪切板的使用
- iPhone开发笔记(11)用ASIFormDataRequest实现图片上传