es_ios_utils icon indicating copy to clipboard operation
es_ios_utils copied to clipboard

ESFlowLayoutView.m

Open nasawz opened this issue 13 years ago • 0 comments

//Orders in rows. Could be improved to save initial widths for items that are too wide to fit a row.

  • (void)layoutSubviews { double rowY = padding; double maxHeight = 0.0; double curX = padding; int itemsInRow = 0;

    for(UIView *v in self.subviews) { //start a new row if needed. If the first item is too wide, present it regardless. if(itemsInRow>0 && curX+v.width > self.width) { rowY = maxHeight + padding; //maxHeight = 0.0; curX = padding; itemsInRow = 0; }

    v.y = rowY;
    v.x = curX;
    curX += v.width + padding;
    maxHeight = MAX(maxHeight, (v.height + v.y));
    itemsInRow++;
    

    } self.height = rowY + maxHeight + padding; }

nasawz avatar Dec 29 '11 06:12 nasawz