我正在设置 UIButton 以垂直方向落在 iPad 屏幕上设置代码类似于
CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
theAnimation.repeatCount=1e100;
theAnimation.autoreverses=NO;
for (UIButton *vbtn in flakesArray) {
//vbtn.userInteractionEnabled =YES;
[vbtn addTarget:self
action:@selector(aMethodTesting:)
forControlEvents:UIControlEventTouchUpInside];
CGPoint p = vbtn.center;
startypos = p.y;
NSLog(@"%f",startypos);
endypos = self.view.frame.size.height;
p.y = endypos;
NSLog(@"%f",endypos);
vbtn.center = p;
//float timeInterval = ((Float32)(animationDurationMax-animationDurationMin)*(Float32)random()/(Float32)RAND_MAX);
theAnimation.duration=200;
theAnimation.fromValue=[NSNumber numberWithFloat:-startypos];
[vbtn.layer addAnimation:theAnimation forKey:@"transform.translation.y"];
[self.view addSubview:vbtn];
[self.view bringSubviewToFront:vbtn];
}
但是这段代码不允许我的 UIButton 调用方法 aMethodTesting:有什么帮助吗?