Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MZTimerLabel/MZTimerLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -110,6 +110,7 @@ typedef enum{
#endif
-(void)pause;
-(void)reset;
- (void)cleanTimerLabel;

/*--------Setter methods*/
-(void)setCountDownTime:(NSTimeInterval)time;
Expand Down
10 changes: 9 additions & 1 deletion MZTimerLabel/MZTimerLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -126,6 +133,7 @@ - (void)setCountDownTime:(NSTimeInterval)time{

timeUserValue = (time < 0)? 0 : time;
timeToCountOff = [date1970 dateByAddingTimeInterval:timeUserValue];
timeToCountOff = [timeToCountOff dateByAddingTimeInterval:0.99];
[self updateLabel];
}

Expand Down