如何从代码中截取屏幕截图?
答案 0 :(得分:5)
#include <QuartzCore/QuartzCore.h>
UIGraphicsBeginImageContext(Background.bounds.size);
[Background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);