oc 根据角标反推NsIndexPath

2016-05-08  本文已影响56人  一个纠结的人

    ![] //根据角标,反推indexPath

- (NSIndexPath*)indexPathWithIndex:(NSInteger)index{

NSIntegersection =0;

NSIntegerrow =0;

for(inti =0; i<=self.nameSectionArray.count-1; i++) {

NSString*key =self.nameSectionArray[i];

NSArray* array =self.nameSectionDic[key];

NSIntegerarrayCount = array.count;

if(index <=arrayCount-1){

section = i;

row = index;

break;

}else{

index -= arrayCount;

}

}

return[NSIndexPathindexPathForRow:rowinSection:section];

}

上一篇下一篇

猜你喜欢

热点阅读