View의 이동에 애니메이션 효과 주기
iOS2010. 1. 22. 11:16
아래 함수를 원하는 형태로 고처서 사용하세요.
- (void)animation:(UIView *)targetView view:(CGRect)toRect {
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context]; //애니메이션 블럭의 시작
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; //애니메이션 효과선택
[UIView setAnimationDuration:0.3f]; //애니메이션 동작(?)시간
// 이 사이에 원하는 뷰의 이동을 정의 하세요.
[targetView setFrame:toRect];
// 여기까지
[UIView commitAnimations]; // 애니메이션 효과 시작
}
사용예)
[self animation:pickerView view:CGRectMake(0, self.view.frame.size.height, pickerView.frame.size.width, pickerView.frame.size.height)];
- (void)animation:(UIView *)targetView view:(CGRect)toRect {
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context]; //애니메이션 블럭의 시작
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; //애니메이션 효과선택
[UIView setAnimationDuration:0.3f]; //애니메이션 동작(?)시간
// 이 사이에 원하는 뷰의 이동을 정의 하세요.
[targetView setFrame:toRect];
// 여기까지
[UIView commitAnimations]; // 애니메이션 효과 시작
}
사용예)
[self animation:pickerView view:CGRectMake(0, self.view.frame.size.height, pickerView.frame.size.width, pickerView.frame.size.height)];
'iOS' 카테고리의 다른 글
[iOS] 이미지 합치기(Image Merge) (0) | 2011.07.01 |
---|---|
[iOS] NSString Encoding (0) | 2011.07.01 |
[iOS] NSString(문자열) 클래스 이름으로 부터 해당 클래스 객체 생성하기 (0) | 2011.03.09 |
[iOS] 로그(NSLog) 기록 (0) | 2011.01.17 |
[아이폰] "누구니?" 두둥! 최초 유료어플 등록 (0) | 2010.04.16 |
[아이폰] 깊은 뮤터블 복사(mutableCopy) (5) | 2010.01.27 |
iPod touch인지 iPhone 인지 구분하기 (0) | 2010.01.22 |
[아이폰] 인터넷 연결 확인 (0) | 2010.01.22 |
날짜(NSDate)를 원하는 포멧의 문자형태(NSString)로 받기 (0) | 2010.01.22 |
로딩이미지(Default.png) 애니메이션 주기 (1) | 2010.01.22 |