布局九宫格
// 布局九宫格
- (void)layoutSubviews
{
[super layoutSubviews];
// 计算九宫格位置
CGFloat w = 74;
CGFloat h = w;
int colCount = 3;
CGFloat margin = (self.frame.size.width - 3 * w) / 4;
for (int i = 0; i < self.btns.count; i++) {
CGFloat x = (i % colCount) * (margin + w) + margin;
CGFloat y = (i / colCount) * (margin + w) + margin;
[self.btns[i] setFrame:CGRectMake(x, y, w, h)];
}
}