File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ typedef enum{
77
77
/* Used for replace text in range */
78
78
@property (nonatomic, assign) NSRange textRange;
79
79
80
+ @property (nonatomic, strong) NSDictionary *attributedDictionaryForTextInRange;
81
+
80
82
/* Type to choose from stopwatch or timer*/
81
83
@property (assign) MZTimerLabelType timerType;
82
84
Original file line number Diff line number Diff line change @@ -365,8 +365,19 @@ -(void)updateLabel{
365
365
// 0.4.7 added---endb//
366
366
}else {
367
367
if (self.textRange .length > 0 ){
368
- NSString * labelText = [self .text stringByReplacingCharactersInRange: self .textRange withString: [self .dateFormatter stringFromDate: timeToShow]];
369
- self.timeLabel .text = labelText;
368
+ if (self.attributedDictionaryForTextInRange ){
369
+
370
+ NSAttributedString *attrTextInRange = [[NSAttributedString alloc ] initWithString: [self .dateFormatter stringFromDate: timeToShow] attributes: self .attributedDictionaryForTextInRange];
371
+
372
+ NSMutableAttributedString *attributedString;
373
+ attributedString = [[NSMutableAttributedString alloc ]initWithString:self .text];
374
+ [attributedString replaceCharactersInRange: self .textRange withAttributedString: attrTextInRange];
375
+ self.timeLabel .attributedText = attributedString;
376
+
377
+ } else {
378
+ NSString *labelText = [self .text stringByReplacingCharactersInRange: self .textRange withString: [self .dateFormatter stringFromDate: timeToShow]];
379
+ self.timeLabel .text = labelText;
380
+ }
370
381
} else {
371
382
self.timeLabel .text = [self .dateFormatter stringFromDate: timeToShow];
372
383
}
You can’t perform that action at this time.
0 commit comments