From bc1307285b2d4bf778e005dbde3abe3abc09461a Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 15 Sep 2020 16:16:38 +0300 Subject: [PATCH] Add dots to attributed texts programatically --- Riot/Utils/EventFormatter.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Riot/Utils/EventFormatter.m b/Riot/Utils/EventFormatter.m index 8266eb221..b6ce37b81 100644 --- a/Riot/Utils/EventFormatter.m +++ b/Riot/Utils/EventFormatter.m @@ -180,7 +180,10 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; } else { - return [super attributedStringFromEvent:event withRoomState:roomState error:error]; + NSAttributedString *string = [super attributedStringFromEvent:event withRoomState:roomState error:error]; + NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithString:@"· "]; + [result appendAttributedString:string]; + return result; } } @@ -268,11 +271,12 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; displayText = [super attributedStringFromEvent:roomCreateEvent withRoomState:roomState error:&tmpError].string; NSAttributedString *rendered = [self renderString:displayText forEvent:roomCreateEvent]; - NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithAttributedString:rendered]; + NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithString:@"· "]; + [result appendAttributedString:rendered]; [result setAttributes:@{ NSFontAttributeName: [UIFont systemFontOfSize:13], NSForegroundColorAttributeName: ThemeService.shared.theme.textSecondaryColor - } range:NSMakeRange(0, rendered.length)]; + } range:NSMakeRange(0, result.length)]; // add one-char space [result appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; // add more link