iPadの画面に垂直方向に落ちるようにUIButtonを設定しています。次のようなコードを設定しています。
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を呼び出すことはできません:ヘルプ??