나는 초보자이며 도움이 필요합니다.이 애니메이션 코드는 어떻게 사용할 수 있습니까?
주어진 UIView에서 팝업 이미지를 표시하고 싶지만 UIAlertView처럼 동작하거나 iPhone 모달 팝업 창에 대한 Facebook Connect와 같이 멋지고 튼튼한 밴드 모양의 애니메이션이 필요합니다. 그것에.
비슷한 것을하려고하는 사람으로부터 그물에 어떤 코드가 있음을 발견했습니다. 그/그녀는 이것을 집어 넣었지만 데모 나 지시 사항은 없었습니다.
나는 너무 새롭기 때문에 이것을 내 코드에 통합하는 방법에 대해서는 전혀 모른다. 당신이 내게 줄 수있는 모든 도움에 미리
float pulsesteps[3] = { 0.2, 1/15., 1/7.5 };
- (void) pulse {
self.transform = CGAffineTransformMakeScale(0.6, 0.6);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:pulsesteps[0]];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)];
self.transform = CGAffineTransformMakeScale(1.1, 1.1);
[UIView commitAnimations];
}
- (void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:pulsesteps[1]];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)];
self.transform = CGAffineTransformMakeScale(0.9, 0.9);
[UIView commitAnimations];
}
- (void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:pulsesteps[2]];
self.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
}
감사 :
- (void) showProductDetail
{
. . .
////////////////////////////////////////////////////////////////////////
// THIS IS A STRAIGHT SCALE ANIMATION RIGHT NOW. I WANT TO REPLACE THIS
// WITH A BOUNCY RUBBER-BAND ANIMATION
_productDetail.transform = CGAffineTransformMakeScale(0.1,0.1);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
_productDetail.transform = CGAffineTransformMakeScale(1,1);
[UIView commitAnimations];
}
. . .
}
이것은 내가 찾은 코드는 다음과 같습니다
이
내가 표시 탄력 이미지를 필요로하는 루틴입니다.
문제가 해결되면 Felixyz의 대답을 받아 들여야합니다. – neha