UIView를 통해 animation을 수행하고 animation이 수행되는 중간 중간에 bounds나 frame값을 얻어오면 최종 좌표로 얻어오는 것을 볼 수 있습니다.

예를 들어 다음과 같은 코드를 실행한다면
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:10.0f];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
CGRect bounds;
bounds = [self bounds];
bounds.origin.x += 100.0f;
[self setBounds:bounds];
[UIView commitAnimations];


10.0시간 동안 100.0만큼 오른쪽으로 움직입니다.
등속도로 설정 하였으니, 5.0시간이 지났을 경우 50.0만큼 오른쪽으로 이동하는 것을 볼 수 있습니다.
원래 x값이 13.0이라고 하였을 때 63.0이라는 값을 기대할 수 있겠죠.

그런데 이 때 [bounds] 값을 얻어오면 최종, 즉 x가 113.0을 나타내고 있습니다.
이러한 상황에서 실제 보여지는 좌표의 값을 얻어오기 위해서는 다음과 같은 값을 사용합니다.

[[[self layer] presentationLayer] bounds];


(컴파일 하면 warning이 나오는데 그냥 무시하세요 =ㅁ=)

출처:
크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by 장현준

2009/03/25 20:36 2009/03/25 20:36
, ,
Response
No Trackback , No Comment
RSS :
http://b4you.net/blog/rss/response/207


블로그 이미지

빗소리를 먹는 사람.

- 장현준

Notices

Archives

Authors

  1. 장현준

Recent Trackbacks

  1. 듀얼클러치의 생각 rsvin28's me2DAY 2009

Calendar

«   2012/02   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

Site Stats

Total hits:
158009
Today:
79
Yesterday:
228