0

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);

}
4

1 に答える 1

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);
}
于 2012-06-20T12:52:11.530 に答える