예제)
#import <QuartzCore/QuartzCore.h> - (UIImage*)captureView:(UIView *)view { CGRect rect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [view.layer renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; } - (void)saveScreenshotToPhotosAlbum:(UIView *)view { UIImageWriteToSavedPhotosAlbum([self captureView:view], nil, nil, nil); }
-> Returns a UIImage that contains a render of any UIView(except EAGLView).
If you pass your app's UIWindow into this method, it will return you a screenshot of the app.
'iPhone dev. > UIView, UITableView' 카테고리의 다른 글
UITapGestureRecognizer를 view에 적용했을 때 view의 button들이 먹통되는 현상 (0) | 2012.06.13 |
---|---|
TableViewCell Default Font (0) | 2012.02.19 |
UITableViewController를 UIViewController로 바꿀 때 참고 (0) | 2011.11.16 |