- (void)settingShopView:(XMGShopView *)shopView index:(NSUInteger)index
{
if (self.isCircle) {
CGFloat center = self.blueView.frame.size.width * 0.5;
NSLog(@"centerY = %f)",center);
CGFloat radius = self.blueView.frame.size.width * 0.4;
NSLog(@"radius = %f)",radius);
CGFloat angle = (M_PI * 2) / self.shops.count * index;
NSLog(@"------%ld",index);
NSLog(@"angle = %f)",angle);
CGFloat centerX = center + radius * sin(angle);
CGFloat centerY = center + 30 + radius * cos(angle);
shopView.center = CGPointMake(centerX, centerY);
} else {
CGRect frame = shopView.frame;
NSUInteger maxCols = 3;
CGFloat margin = (self.blueView.frame.size.width - maxCols * shopView.frame.size.width) / (maxCols - 1);
frame.origin.x = (index % maxCols) * (shopView.frame.size.width + margin);
frame.origin.y = (index / maxCols) * (shopView.frame.size.height + margin);
shopView.frame = frame;
}
}
{
if (self.isCircle) {
CGFloat center = self.blueView.frame.size.width * 0.5;
NSLog(@"centerY = %f)",center);
CGFloat radius = self.blueView.frame.size.width * 0.4;
NSLog(@"radius = %f)",radius);
CGFloat angle = (M_PI * 2) / self.shops.count * index;
NSLog(@"------%ld",index);
NSLog(@"angle = %f)",angle);
CGFloat centerX = center + radius * sin(angle);
CGFloat centerY = center + 30 + radius * cos(angle);
shopView.center = CGPointMake(centerX, centerY);
} else {
CGRect frame = shopView.frame;
NSUInteger maxCols = 3;
CGFloat margin = (self.blueView.frame.size.width - maxCols * shopView.frame.size.width) / (maxCols - 1);
frame.origin.x = (index % maxCols) * (shopView.frame.size.width + margin);
frame.origin.y = (index / maxCols) * (shopView.frame.size.height + margin);
shopView.frame = frame;
}
}