开发者

NSImage mouse events

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 开发者_C百科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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜