NSIndexPath 是一個對象,它用來表示一個樹形的記錄地址欢顷。
提到UITableView,就必須的說一說NSIndexPath法挨。UITableView聲明了一個NSIndexPath的類別,主要用 來標(biāo)識當(dāng)前cell的在tableView中的位置幅聘,該類別有section和row兩個屬性凡纳,前者標(biāo)識當(dāng)前cell處于第幾個section中,后者代 表在該section中的第幾行帝蒿。
UITableView只能有一列數(shù)據(jù)(cell)荐糜,且只支持縱向滑動,當(dāng)創(chuàng)建好的tablView第一次顯示的時候葛超,我們需要調(diào)用其reloadData方法暴氏,強(qiáng)制刷新一次,從而使tableView的數(shù)據(jù)更新到最新狀態(tài)绣张。
NSIndexPath的創(chuàng)建
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
-(void)cellImageDidLoad:(NSIndexPath *)indexPath image:(UIImage *)image
{
UITableViewCell *cell = [wqTablecellForRowAtIndexPath:indexPath];
cell.imageView.image = image;
}