#define Heig [UIScreen mainScreen].bounds.size.height
#define kTurntableNum 10
#define DEGREES_TO_RADIANS(d) (d * M_PI / 180)
CGFloat angle = DEGREES_TO_RADIANS((180.0/kTurntableNum));
// currentTag = 0;
for (int i = 0; i < kTurntableNum; i++)
{
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.tag = i;
//55,55
[button1 setFrame:CGRectMake(13.5/667.0*Heig,64+(66+235- 27.5)/667.0*Heig ,56/667.0*Heig, 56/667.0*Heig)];
// position.x = frame.origin.x + 0.5 * bounds.size.width;
// position.y = frame.origin.y + 0.5 * bounds.size.height;
button1.layer.anchorPoint = CGPointMake(0.5,4.7);//(0.5,1.0)
button1.layer.transform= CATransform3DMakeRotation(angle * i *1.113,0.0, 0.0, 1.0);
[button1 setTitle:@(i).stringValue forState:UIControlStateNormal];
button1.backgroundColor = [UIColor yellowColor];
button1.layer.masksToBounds = YES;
button1.layer.cornerRadius = 28/667.0*Heig;
[button1 addTarget:self action:@selector(buttonDown:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button1];
}
网友评论