我想知道在 iphone 中我们可以在 1 秒内截取多少张截图。目前我收到了 5 张截图。这是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(saveImageInPhotoAlbum) userInfo:nil repeats:YES];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)saveImageInPhotoAlbum
{
UIGraphicsBeginImageContext(CGSizeMake(self.view.frame.size.width,self.view.frame.size.height));
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(screenShot)];
UIImage *image=[UIImage imageWithData:imageData];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}