123456789101112131415161718192021222324252627282930313233343536373839 |
- //
- // SKInCallViewController+time.m
- // SikeyComm
- //
- // Created by 刘振兴 on 2025/2/14.
- // Copyright © 2025 BaH Cy. All rights reserved.
- //
- #import "SKInCallViewController+time.h"
- @implementation SKInCallViewController (time)
- - (void)startTimer {
- if (self.mTimer == nil) {
- self.mTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(talkingTimeCallback) userInfo:nil repeats:YES];
- }
- self.mTimecost = 0;
- }
- - (void)stopTimer {
- if (self.mTimer) {
- [self.mTimer invalidate];
- self.mTimer = nil;
- }
- }
- - (void)talkingTimeCallback {
- self.mTimecost++;
- self.mIngHeaderView.hidden = NO;
- JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
- self.mIngTimeLabel.text = [self formatTalkingTime:self.mTimecost];
- self.mIngNetWorkLabel.text = @"";
- }
- - (NSString *)formatTalkingTime:(long)time {
- return [NSString stringWithFormat:@"%02ld:%02ld", time/60, time%60];
- }
- @end
|