UIView 애니메이션은 레이어의 애니메이션이 아닌보기 속성에 애니메이션을 적용하기위한 것입니다. 필자가 아는 한, UIView animateWithDuration : 호출을 사용하여 뷰의 레이어를 애니메이션으로 만들 수는 없습니다.
CABasicAnimation을 만들고보기 레이어에 직접 추가해야합니다. 그래서, 당신은이 애니메이션을하기 전에, 1 .5 레이어의 기준점을 이동해야
을 atxe가 말하기를 :
은 내가 CAAnimations을 수행 한 이후 오랜만 만의 내가 발굴 할 수 있는지 보자 있어요 오른쪽 가장자리를 중심으로 회전합니다.
//Open the door.
rotateAnimation = [CABasicAnimation animation];
rotateAnimation.keyPath = @"transform";
rotateAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
//Pivot on the right edge (y axis rotation)
theTransform = CATransform3DIdentity;
theTransform.m34 = -1/100.0;
theTransform = CATransform3DRotate(theTransform, degreesToRadians(70), 0, 1, 0);
rotateAnimation.toValue = [NSValue valueWithCATransform3D:theTransform];
rotateAnimation.duration = 0.5;
// leaves presentation layer in final state; preventing snap-back to original state
rotateAnimation.removedOnCompletion = NO;
rotateAnimation.fillMode = kCAFillModeBoth;
rotateAnimation.repeatCount = 0;
rotateAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
rotateAnimation.delegate = self;
[treeDoorImageView.layer addAnimation:rotateAnimation forKey:@"transform"];
논리를 변환은 당신에 대한 모든하지만 동일입니다 (제가 사용 : 여기
는 문 애니메이션은 그것의 경첩에 열려 스윙 않는 우리의 "케빈 & 켈"만화 앱에서 일부 코드 +1/100의 m34 값을 사용하면 과장된 3D 효과를 얻을 수 있습니다.
UIView 애니메이션 블록에서 애니메이션을 재생하는 대신 CABasicAnimation을 만들고, fromValue 및 toValue 속성을 시작 및 끝 변환 값으로 설정합니다.
이 코드를 애니메이션의 시작점으로 사용할 수 있어야합니다.
앵커 포인트를 변경하려고 시도 했습니까? http://stackoverflow.com/questions/7438385/ios-rotate-view-around-an-anchor-point-and-follow-touch – atxe