0

アプリ画面のビデオを作成して、アプリがどのように機能するかをクライアントに示すツールを作成したいと考えています。
したがって、毎秒30〜60回ウィンドウのスクリーンショットを取得し、ドキュメントに保存したいと考えています。アプリを閉じた後、そのファイルからビデオを作成すると、アプリのビデオが作成されます。アプリをアプリストアに送信するときは、ビデオとアプリのスクリーンショットを作成するために削除またはキャンセルします。

//Get list of document directories in sandbox
    NSArray *documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDirectory, YES);
    //Get one and only document directory from that list
    self.documentFolder = [documentDirectories objectAtIndex:0];

    self.images = [[NSMutableArray alloc] init];
    //Append passed in file name to that directory, return it

    _counter = 0;
    self.timerCapture = [NSTimer scheduledTimerWithTimeInterval: 1.0f/30.0f
                                             target: self
                                           selector: @selector(getWindowCapture:)
                                           userInfo: nil
                                            repeats: YES];


- (UIImage *)captureScreen {
    CALayer *layer;
    layer = self.window.layer;
    UIGraphicsBeginImageContextWithOptions(self.window.bounds.size, NO, 1.0f); 
    [layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return screenImage;
}


問題は、アニメーション中に UIWindow をキャプチャできないことですか?
これどうやってするの?

4

2 に答える 2

3


[layer.presentationLayer renderInContext:UIGraphicsGetCurrentContext()];
代わりにこれを使用してください
[layer renderInContext:UIGraphicsGetCurrentContext()];

于 2012-04-22T22:00:54.847 に答える