PDA

View Full Version : How to subclass NSImageView and add NSBezierPaths to it?




ranguvar
Sep 18, 2009, 03:57 PM
Hi everybody,

I'm currently developing an app that allows the user to track where they have moved on a map. I'd like to create a CustomView, which is a subclass of NSImageView. The view should draw both the image of the map and NSBezierPaths that represent the track.
Now my questions are:
1. How do I create a subclass of NSImageView? Specifically, how can I customize the '- (void)drawRect:(NSRect)dirtyRect' while still drawing the image set in InterfaceBuilder?
2. How can I add instances of NSBezierPath to the view, on top of the image of the map?

Thanks for any input!



GorillaPaws
Sep 18, 2009, 05:04 PM
You might want to consider using Core Animation's layers for this.

lloyddean
Sep 18, 2009, 11:29 PM
Easier to point you at the fine article at:
http://www.cocoadevcentral.com/d/intro_to_quartz_two/