timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(myMethod) userInfo:nil repeats:YES];
-(void)myMethod {
//my every second requirment
//my every minute requirment
}
내 타이머 틱 초마다하고 내 요구 사항을하지만 난 때 몇 가지 코드를 트리거 할 예를 들어 내 응용 프로그램은 오전 10시 5분 30초을 시작하는 또 다른 요구 사항이있는 그 10:06:00 그리고 다시 10:07:00이되면 계속됩니다.추출 분 양식 NSTimer 어느 틱 초마다
I는 나에게 좋은 해결책처럼 보이는없는이
date1 = dateFormatter ... date // this will give 10:05:30
date2 = dateFormatter ... date // this will give 10:05:00
date2 = addition of minute // this will give 10:06:00
and finally date1 compare date2 == descending // means it currently 10:06:00
하지만 같이 할 생각, 더 나은 솔루션이 있습니까?
당신은 코드의 시작을 실행해야합니다 정확한 분 날짜가 있습니까? 그리고 나서 1 분마다? 그게 네가 필요한거야? –
내 대답을 확인할 수 있습니까? –