[iOS] UIView 흔들기 효과
iOS2011. 9. 28. 09:19
- (void)shakeView:(UIView*)targetView
{
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"position"];
[animation setDuration:0.05];
[animation setRepeatCount:6];
[animation setAutoreverses:YES];
[animation setFromValue:[NSValue valueWithCGPoint: CGPointMake([targetView center].x - 10.0f, [targetView center].y)]];
[animation setToValue:[NSValue valueWithCGPoint: CGPointMake([targetView center].x + 10.0f, [targetView center].y)]];
[[targetView layer] addAnimation:animation forKey:@"position"];
}
'iOS' 카테고리의 다른 글
[iOS] Cocoa Views Guide (Working with the View Hierarchy) (0) | 2012.05.31 |
---|---|
[iOS] animateWithDuration: delay: options: animations: completion: 함수 사용 예 (0) | 2011.10.13 |
[iOS] 외부 폰트 사용하기 (0) | 2011.10.12 |
[iOS] UIWebView 에 Bounce 효과 제거 (0) | 2011.10.10 |
[iOS] 동기적으로 동작하는 UIAlertView (Custom UIAlertView) (0) | 2011.09.28 |
[iOS] In App Purchase 앱에서 구매내역 확인 (0) | 2011.09.20 |
[iOS] 현재 시간을 GMT로 표시하기 (0) | 2011.09.20 |
[iOS] Device ID (0) | 2011.09.19 |
[iOS] 문장이 화면에 표현되는 높이와 길이 얻기 (0) | 2011.09.05 |
[iOS] UITextView를 Rounded Rect 형태로 표현하기 (0) | 2011.09.02 |