-(IBAction)saveViewToPhotoLibrary:(id)sender
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
[self.view.layer renderInContext:ctx];
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage,nil,nil,nil);
//fill cordinat in place of nil if u want only image comes and not button......ok thanks vijay//
UIGraphicsEndImageContext();
}
茹試圖讓scren拍攝 – 2011-04-13 09:20:13