여기 내 질문입니다. 이미지를 움직이게하고 싶습니다. 이미지를 다른 이미지로 돌리고 싶습니다.하지만 어떻게 할 지 모르겠습니다. 나는 그것이 회전하는 것을 원한다. (회전이 아니라 회전하는 것이 원을 돌고있는 것처럼). 어떻게하면 좋을까? 다음mak a uiimageView 다른 이미지를 뒤집기
-(void){
CALayer *orbit1 = [CALayer layer];
orbit1.bounds = CGRectMake(0, 0, 200, 200);
orbit1.position = centre.center;
orbit1.cornerRadius = 100;
orbit1.borderColor= [UIColor redColor].CGColor;
orbit1.borderWidth = 1.5;
planet1 = [CALayer layer];
planet1.bounds = CGRectMake(0, 0, 44.0, 20.0);
planet1.position = CGPointMake(160, 25);
planet1.contents = (id)([UIImage imageNamed:@"bouletest_05.png"].CGImage);
[orbit1 addSublayer:planet1];
CABasicAnimation *anim1 = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim1.fromValue = [NSNumber numberWithFloat:0];
anim1.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
anim1.repeatCount = HUGE_VALF;
anim1.duration = 10.0;
[orbit1 addAnimation:anim1 forKey:@"transform"];
[self.view.layer addSublayer:orbit1];
}
과 : 마지막 줄에
-(void)creation{
imageView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"abouffer_03.png"]];
[[self view] addSubview:imageView2];
imageView2.center=planet1.center;
}
보기 : 여기
내 코드입니다 imageView2.center = planet1.center; 문제가 여기에 있습니다
[Quartz 2D Programming guide] (http://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_affine/dq_affine.html#//apple_ref/doc/uid/TP30001066-CH204)를 확인하십시오. -SW1). 그것은 아주 잘 설명합니다. – ender