I'm trying to write some objective-c code that allows capture of frames through the iPhone camera, after a specific time delay. Any examples I have found online have captured the 'present' frame input by the camera (ie a realtime frame capture). I am looking for a less real time frame capture - a way to capture frames with a specific time delay. Any ideas?
I would use NSTimer
. It would allow you to use the code that captures the current frame, and it would get called after a delay.
You can create a non-repeating timer like this: timer = [NSTimer scheduledTimerWithTimerInterval:delay target:self selector:@selector(capture) userInfo:nil repeats:NO];
where delay
is the specific time delay and capture
is a method that contains the code from an example that captures the present frame.
Use following code.....
//call method according to your delay that you need.....
float yourdelay;
yourdelay = 0.7;
[self performSelector:@selector(captureView) withObject:nil afterDelay:yourdelay];
// or set time for calling method....
[NSTimer scheduledTimerWithTimeInterval:0.02 target: self selector:@selector(captureView) userInfo:nil repeats:NO];
///or you can call method directly when you need..
[self captureView];
////Here the code for capture real time image.
- (void)captureView {
UIGraphicsBeginImageContext(mapView.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
flickerImaveView.image=viewImage;
}
Hope this will help you....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.