SWTableView(CCTableView)移动列表项到指定索引对应的cell


http://blog.csdn.net/wzq9706/article/details/9105915


+(void) setTableOffsetToIndex:(SWTableView*) table itemCounts:(int) itemCounts index:(int) index cellSize:(CGSize) cellSize {
    
    float offsetX = 0;
    float offsetY = 0;
    if (table.direction == SWScrollViewDirectionVertical) {
        if (table.verticalFillOrder == SWTableViewFillTopDown) {
            offsetY =  -cellSize.height * (itemCounts - index - 1);
        } else {
            offsetY =  -cellSize.height * index;
        }
    } else  {
        if (table.verticalFillOrder == SWTableViewFillTopDown) {
            offsetX =  -cellSize.width * (itemCounts - index - 1);
        } else {
            offsetX =  -cellSize.width * index;
        }
    }
    
    [table setContentOffset:ccp(offsetX, offsetY)];
}


原文地址:https://www.cnblogs.com/iapp/p/3631721.html