您的位置:首页 > 产品设计 > UI/UE

UITableView NSIndexPath属性讲解

2013-06-06 09:04 162 查看
NSIndexPath 是一个对象,它用来表示一个树形的记录地址。

提到UITableView,就必须的说一说NSIndexPath。UITableView声明了一个NSIndexPath的类别,主要用 来标识当前cell的在tableView中的位置,该类别有section和row两个属性,前者标识当前cell处于第几个section中,后者代 表在该section中的第几行。  UITableView只能有一列数据(cell),且只支持纵向滑动,当创建好的tablView第一次显示的时候,我们需要调用其reloadData方法,强制刷新一次,从而使tableView的数据更新到最新状态。

NSIndexPath的创建

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

-(void)cellImageDidLoad:(NSIndexPath *)indexPath image:(UIImage *)image
{
UITableViewCell *cell = [wqTablecellForRowAtIndexPath:indexPath];
cell.imageView.image = image;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  记录