3
我正在寻找最简洁的方式,当用户点击“拍照”按钮时,倒数计时器会触发。有没有简单的方法来做到这一点?iOS相机倒数计时器
我在想的一个解决方案是只需要每秒更新一次的标签,但有没有办法像Photobooth一样工作?
此外,在照片即将拍摄之前的最后一秒,我希望图像在拍摄时短暂显示。我怎么去解决这个问题?
任何帮助将是伟大的,谢谢!
我正在寻找最简洁的方式,当用户点击“拍照”按钮时,倒数计时器会触发。有没有简单的方法来做到这一点?iOS相机倒数计时器
我在想的一个解决方案是只需要每秒更新一次的标签,但有没有办法像Photobooth一样工作?
此外,在照片即将拍摄之前的最后一秒,我希望图像在拍摄时短暂显示。我怎么去解决这个问题?
任何帮助将是伟大的,谢谢!
- (IBAction)takePicture:(id)sender {
theTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateLabel:) userInfo:nil repeats:NO];
}
- (void)updateLabel:(NSTimer *)timer {
_timeLabel.text = [NSString stringWithFormat:@"%d", time];
time = time - 1;
if (time == 0) {
[theTimer invalidate];
[_timeLabel performSelector:@selector(setText:) withObject:@"Photo taken!" afterDelay:1.0];
//Code for image shown at last second
} else {
theTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateLabel:) userInfo:nil repeats:NO];
}
}
希望这有助于;)
谢谢!我会给这个镜头,我会告诉你它是否有效。这只是更新标签,但正确吗?它与“photobooth”倒数计时器不一样。 – arooo
是的,只有标签,但photobooth倒计时现在没有那么难,只需添加一个UIPageControl,就可以实现:O –