I'm trying to capture the contents of a WebView
and saving it as an image. This is my code right now (cv
is the web view):
[cv lockFocus];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[cv bounds]];
[cv unlockFocus];
NSData *data = [rep TIFFRepresentation];
[data writeToFile:[[save URL] path] atomically:NO];
All I get is a gray image with the correct size. What am I doing wrong?