2011-01-27 2 views
1

보기의 크기를 윈도우의 다른 위치로 옮기고 싶습니다. 나는 현재 NSWindowDidResizeNotification 수신시 NSViewAnimation을 사용하여이 작업을 수행합니다.iPhone과 마찬가지로 NSAnimation을 "현재 상태에서 시작"할 수 있습니까?

// Create the view animation object. 
theAnim = [[NSViewAnimation alloc] initWithViewAnimations:animation]; 
// Set some additional attributes for the animation. 
[theAnim setDuration:1]; // One and a half seconds. 
[theAnim setAnimationCurve:NSAnimationEaseIn]; 
[theAnim setFrameRate:20.0]; 
[theAnim setAnimationBlockingMode:NSAnimationNonblocking]; 
// Run the animation. 
[theAnim startAnimation]; 
// The animation has finished, so go ahead and release it. 
[theAnim release]; 

내가 창 크기를 조정할 때이 코드는 여러 번 호출 ("애니메이션"NSAnimation이 그것을 원하는처럼 내보기에 대한 새로운 RECT를 포함하는 딕셔너리와 배열입니다). 따라서 크기를 조정할 때이 코드는 한 번의 크기 조정에 약 20 회 호출됩니다. 나는 이제 20 개의 애니메이션보기를 움직인다. 겹치는 20 개의 다른 것들. (여러 가지 다른보기처럼 보입니다. 그러나 애니메이션 사이에서 호핑하는 것 같아요.)

iPhone에서는보기 만 이동하고 [UIView setAnimationBeginsFromCurrentState : YES]를 설정할 수 있으며 제대로 작동합니다. OSX에서이 작업을 수행 할 수있는 방법이 있습니까? 뷰에 isAnimating 변수를 만들 수는 있지만 한 위치로만 이동하고 애니메이션을 적용하는 동안 빠른 크기 조정은 무시됩니다.

어떻게하면 OSX에서이 작업을 수행 할 수 있습니까? 감사합니다.

답변

2

방금 ​​[[album.view animator] setFrame : newFrame]; 그리고 거기로 옮겼습니다. 아름다운. (놀라운 점은 무엇입니까?)