PDA

View Full Version : Save NSView as TIFF




Darkroom
Jul 2, 2008, 06:51 AM
this isn't working right now, but i think i'm on the right path... maybe i just have something small missing from the method?

it's an IBAction method. user activates the actions, the NSView is suppose to convert into a TIFF and save itself to the desktop.


-(IBAction)saveViewToDesktop:(id)sender
{
[self lockFocus];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[self bounds]];
[self unlockFocus];
NSData *data = [rep TIFFRepresentation];
NSString *filePath = @"/Users/myrealname/Desktop/";
[data writeToFile:filePath atomically:YES];
}



Darkroom
Jul 2, 2008, 11:02 AM
i wrote over my old post with this post. i had found the answer before anyone responded.

robbieduncan
Jul 2, 2008, 11:11 AM
The answer being that you didn't provide a file name in the path you were saving to?

Darkroom
Jul 2, 2008, 11:15 AM
The answer being that you didn't provide a file name in the path you were saving to?

omg... ha... that was very special of me wasn't it :p

thanks robbieduncan :)