0
iPhone의 잠금 해제 메커니즘과 같은 슬라이더 막대 유형의 UI 컨트롤을 구현했습니다.애니메이션이 포함 된 UIImageView 이동하기
touchesEnded 메서드가 호출되면 슬라이더를 시작 위치로 되돌립니다. 대신, 나는 그것의 시작 위치로 돌아 가기 위해 움직이게하고 싶습니다.
코드는 이와 같아야하지만 작동하지 않습니다. 여기서 내가 뭘 잘못하고 있니? 뼈 달린 질문에 대한
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
theAnimation.fromValue = [NSNumber numberWithFloat:BEGINX];
theAnimation.toValue = [NSNumber numberWithFloat: 0.0];
theAnimation.duration = 0.5;
[self.unlock addAnimation: theAnimation];
죄송합니다 :
Self.unlock가있는 UIImageView입니다!
안녕하세요, 감사합니다 ... 나는 그것을 잘못하고 있다고 생각한다. 다음 코드를 시도하고 "UIImageView 응답하지 않을 수 있습니다"두 번 경고 : \t \t [self.unlock beginAnimations : nil context : nil]; \t \t [self.unlock setAnimationDuration : 0.5]; \t \t self.unlock.frame = CGRectMake (0, 0, 75, 37); \t \t [self.unlock commitAnimations]; –
신경 쓰지 마세요, 귀하의 코드가 정확하게 작성된 것으로 보입니다. 매력처럼 작동합니다. 감사! –