jackyshan

导航

 

代码

buttonX = 0;
buttonW = 50;
buttonH = 20;
margin = (self.view.width - 5 * buttonW) / 6;
CGFloat ymargin = 17;
for (int i = 0; i < self.platformArr.count; i++) {
    YTBottomTitleButton *button = self.platformArr[i];
    buttonX = margin +  (i % 5 == 0 ? 0 : (buttonW + margin) * (i % 5)) + (i % 20 == 0 ? ZWScreenW * i / 20 : ZWScreenW * (i - i % 20) / 20);
    buttonY = i % 5 == 0 ? (i % 20 == 0 ? ymargin : ymargin + (buttonH + ymargin) * ((i % 20) / 5)) : buttonY;        
    button.frame = CGRectMake(buttonX, buttonY, buttonW, buttonH);
}

NSInteger offset = self.platformArr.count > 20 ? (self.platformArr.count % 20 == 0 ? self.platformArr.count / 20 : self.platformArr.count / 20 + 1) : 0;
self.platformScrollView.contentSize = CGSizeMake(offset * ZWScreenW, 0);
posted on 2016-05-12 20:17  jackyshan  阅读(594)  评论(0编辑  收藏  举报