Skip to content

canapio/TimeEngine-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

TimeEngine-iOS

This is time listener demo for clock application.

I use NSDate(Categories) from Alexey Belkevich. Thank you!

Usage

#### Include header at top. ```objective-c #import "TimeEngine.h" ```

Set up and start timer.

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [TimeEngine shared].changeType = tType_second;      // 초 단위로 호출      timeChanged:changeType: 호출
    [TimeEngine shared].afterInterval = .1f;            // 시간이 바뀌기 직전에  timeWillChange:changeType:afterInterval: 를 호출
    [TimeEngine shared].delegate = self;                // delegate를 설정
    [[TimeEngine shared] MAKE_TIMER];                   // 타이머 시작
}

Implement delegate.

#pragma mark - Time Engine Delegate
- (void) timeWillChange:(NSDate *)date changeType:(enum TimeChangeType)type afterInterval:(float)afterT {
    NSLog(@"time will change after %f", afterT);
}
- (void) timeChanged:(NSDate *)date changeType:(enum TimeChangeType)type {
    NSLog(@"current time is %@, change type : %zd", date, type);
}

About

This is time listener demo for clock application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published