iPhone中1秒内的最大屏幕截图数

时间:2012-06-20 12:47:39

标签: iphone screenshot

我想知道在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);

}

1 个答案:

答案 0 :(得分:0)

int i=0;
-(void)saveImageInPhotoAlbum
{
    for (int i=0;i<10,i++)
{
    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);
}
i++;
NSLog(@"Counting of Photos= %d",i);
}