Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSView Subclass Question

NSView Subclass Question
Thread Tools
TheoCryst
Mac Elite
Join Date: Nov 2005
Location: Seattle, WA, USA
Status: Offline
Reply With Quote
Jan 2, 2007, 03:02 PM
 
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
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jan 2, 2007, 03:07 PM
 
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'."
     
TheoCryst  (op)
Mac Elite
Join Date: Nov 2005
Location: Seattle, WA, USA
Status: Offline
Reply With Quote
Jan 2, 2007, 03:14 PM
 
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
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jan 2, 2007, 03:35 PM
 
In that case, you can just use NSBitmapImageRep's initWithFocusedViewRect:.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:13 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,