diff --git a/MZTimerLabel/MZTimerLabel.h b/MZTimerLabel/MZTimerLabel.h index 5895aec..0a3c8f8 100644 --- a/MZTimerLabel/MZTimerLabel.h +++ b/MZTimerLabel/MZTimerLabel.h @@ -72,7 +72,7 @@ typedef enum{ @property (nonatomic,copy) NSString *timeFormat; /*Target label obejct, default self if you do not initWithLabel nor set*/ -@property (nonatomic,strong) UILabel *timeLabel; +@property (nonatomic,weak) UILabel *timeLabel; /*Used for replace text in range */ @property (nonatomic, assign) NSRange textRange; @@ -110,6 +110,7 @@ typedef enum{ #endif -(void)pause; -(void)reset; +- (void)cleanTimerLabel; /*--------Setter methods*/ -(void)setCountDownTime:(NSTimeInterval)time; diff --git a/MZTimerLabel/MZTimerLabel.m b/MZTimerLabel/MZTimerLabel.m index ee33133..ea01b11 100644 --- a/MZTimerLabel/MZTimerLabel.m +++ b/MZTimerLabel/MZTimerLabel.m @@ -101,7 +101,14 @@ - (id)initWithCoder:(NSCoder *)aDecoder #pragma mark - Cleanup -- (void) removeFromSuperview { +- (void)cleanTimerLabel { + if (_timer) { + [_timer invalidate]; + _timer = nil; + } +} + +- (void)removeFromSuperview { if (_timer) { [_timer invalidate]; _timer = nil; @@ -126,6 +133,7 @@ - (void)setCountDownTime:(NSTimeInterval)time{ timeUserValue = (time < 0)? 0 : time; timeToCountOff = [date1970 dateByAddingTimeInterval:timeUserValue]; + timeToCountOff = [timeToCountOff dateByAddingTimeInterval:0.99]; [self updateLabel]; }