두 개의 NSScrollView가 서로 스크롤 된 동기화되어 있습니다 (Apple's example 사용). 작동 중입니다. 다음으로 두 이미지를 모두 확대/축소하는 줌을 구현했습니다 (정의에 따라 크기가 같습니다). 내가 동기화 스크롤의없이 줌 기능을 사용하는 경우,NSScrollView의 줌 이미지 (objective-c)
if (oldZoomValue > [sender floatValue]) // then we are zooming in
{
float zoomFactor = 1 + oldZoomValue - [sender floatValue];
oldZoomValue = [sender floatValue];
NSRect visible = [synchroS_ScrollView documentVisibleRect];
NSRect newrect = NSInsetRect(visible, NSWidth(visible)*(1 - 1/zoomFactor)/2.0, NSHeight(visible)*(1 - 1/zoomFactor)/2.0);
NSRect frame = [synchroS_ScrollView.documentView frame];
[synchroS_ScrollView.documentView scaleUnitSquareToSize:NSMakeSize(zoomFactor, zoomFactor)];
[synchroS_ScrollView.documentView setFrame:NSMakeRect(0, 0, frame.size.width * zoomFactor, frame.size.height * zoomFactor)];
[[synchroS_ScrollView documentView] scrollPoint:newrect.origin];
NSRect visibleI = [synchroI_ScrollView documentVisibleRect];
NSRect newrectI = NSInsetRect(visibleI, NSWidth(visibleI)*(1 - 1/zoomFactor)/2.0, NSHeight(visibleI)*(1 - 1/zoomFactor)/2.0);
NSRect frameI = [synchroI_ScrollView.documentView frame];
[synchroI_ScrollView.documentView scaleUnitSquareToSize:NSMakeSize(zoomFactor, zoomFactor)];
[synchroI_ScrollView.documentView setFrame:NSMakeRect(0, 0, frameI.size.width * zoomFactor, frameI.size.height * zoomFactor)];
[[synchroI_ScrollView documentView] scrollPoint:newrectI.origin];
}
else
{
// the equivalent but for zoom-out
}
예상대로 NSScrollView에 두 이미지가 좋게 확대됩니다 줌의 코드는 내가 여기에 제시하는 here에서 코드를 사용하여 적응했다. 그들이 동기화 경우 여러 호출 스택 것으로 보인다으로하지만, 프로그램이 충돌 :
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
sharedlibrary apply-load-rules all
[Switching to process 33162 thread 0x0]
[Switching to process 33162 thread 0xac03]
[Switching to process 33162 thread 0x903]
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
...
(gdb)
: 메인 스레드에, 그것은 GDB
#18 0x0000000100003e37 in -[SynchroScrollView synchronizedViewContentBoundsDidChange:]()
같은과에 많은 것들을 보여줍니다
누구든지 디버그 방향을 알려주거나 어떤 일이 벌어지고 있는지 알 수 있습니까? 도움 주셔서 감사합니다.