|
|
NSView Subclass Question
|
|
|
|
Mac Elite
Join Date: Nov 2005
Location: Seattle, WA, USA
Status:
Offline
|
|
So, I'm subclassing NSView for a document-based program I've been writing. I'm trying to save the contents of the view to file, but I'm not sure how to access this information. It's probably a silly question with an obvious answer, but I've searched the documentation and I can't find anything usable. Tips for a newbie?
|
Any ramblings are entirely my own, and do not represent those of my employers, coworkers, friends, or species
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
I'm unclear on exactly what you mean. If you want a PDF of the view, you could use dataWithPDFInsideRect:. More likely you want to access the same model object the view is hooked up to and save that.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Nov 2005
Location: Seattle, WA, USA
Status:
Offline
|
|
I'm actually looking for a bitmap of the view, oddly enough.
EDIT: Okay, it's half-solved. I was generating empty files because I was implementing bitmapImageRepForCachingDisplayInRect: without using cacheDisplayInRect:toBitmapImageRep:. Now the output is just... wrong.
And yes, I am just writing a simple paint program.
EDIT #2: Okay, I fixed it. I said "screw that" and implemented initWithFocusedViewRect:[self bounds]. Thanks anyway!
(
Last edited by TheoCryst; Jan 2, 2007 at 03:36 PM.
)
|
Any ramblings are entirely my own, and do not represent those of my employers, coworkers, friends, or species
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
In that case, you can just use NSBitmapImageRep's initWithFocusedViewRect:.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|