HI,
I am using following code to convert view into image format:
- (void)printViewToPNG
{
NSData *data;
NSBitmapImageRep *rep;
NSDictionary *properties;
rep = [self bitmapImageRepForCachingDisplayInRect:[self frame]];
[self cacheDisplayInRect:[self frame] toBitmapImageRep:rep];
data = [rep TIFFRepresentation];
properties = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:NSImageInterlaced];
data = [rep representationUsingType:NSPNGFileType properties:properties];
[data writeToFile:[NSHomeDirectory() stringByAppendingPathComponent:@"Desktop/test.png"] atomically:YES];
}
But it gives me errors at NSBitmapImageRep and NSImageInterlaced. I have used the class framework Appkit.framework but not getting specific class that help to remove the errors.
Updated :
I am getting errors like : NSBitmapImageRep & NSImageInterlaced undeclared.
then on the line data = [rep representationUsingType:NSPNGFileType properties:properties]; i m getting NSPNGFileType undeclared.
Any solution for this?
Thanking you.