使用NSTimer可以显示每秒的时间码帧

问题描述

| 我正在使用需要显示运行时间码时钟的iPhone / iPad应用程序。使用此代码,我可以正确显示小时,分钟和秒:
    - (void) viewDidLoad {
        // Start the Timer method for here to start it when the view loads.
            runTimer = [NSTimer scheduledTimerWithTimeInterval: .01 target: self selector: @selector(updateDisplay) userInfo: nil repeats: YES];
    }

- (void)updateDisplay {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        NSDate *date = [NSDate date];

        // Display each hour,minute,second and frame.
        [formatter setDateFormat:@\"hh\"];
        [timecodeHourLabel setText:[formatter stringFromDate:date]];

        [formatter setDateFormat:@\"mm\"];
        [timecodeMinuteLabel setText:[formatter stringFromDate:date]];

        [formatter setDateFormat:@\"ss\"];
        [timecodeSecondLabel setText:[formatter stringFromDate:date]];
}
问题是当我需要每秒显示帧数时。我知道计算
1/24 * 1000
可以得出一帧有多少毫秒。我只是不知道如何使
NSDate
NSTimer
函数与此代码配合使用,并不允许它根据运行时间码的需要尽快更新
UILabel
。 有什么建议么?     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)