문제

I have a number of NSImages that I'm rendering in a custom NSView subclass. I'm looking to enlarge theses images as and when the user places their mouse over them and am wondering about the best way to go about doing this.

Currently I'm using the NSView's drawRect: method to composite the images, but also free to render them via NSImageView instances, if that will make things easier. My initial instinct was to setup NSTrackingArea's for each NSImage instance but wanted to ensure I wasn't missing something obvious.

도움이 되었습니까?

해결책

Possibly a better way to do this would be to set up the images as Core Animation layers. You can then very easily make the images pop up/enlarge in an animated fashion without having to write the drawing code to do it. Performance will be a lot better also.

As for the mouse tracking, NSTrackingArea is a good way to go.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top