美文网首页
oc 根据角标反推NsIndexPath

oc 根据角标反推NsIndexPath

作者: 一个纠结的人 | 来源:发表于2016-05-08 00:23 被阅读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];

    }

    相关文章

      网友评论

          本文标题:oc 根据角标反推NsIndexPath

          本文链接:https://www.haomeiwen.com/subject/muyolttx.html