From aaa0bc8c2284b95187a51b10e44df26758e96718 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 15 May 2020 15:34:00 +0300 Subject: Selection style --- Juick/Views/MessageCell.h | 2 +- Juick/Views/MessageCell.m | 4 +++- Juick/Views/MessageCell.xib | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'Juick/Views') diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 684a620..d50751b 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -26,5 +26,5 @@ @property (nonatomic, strong) id delegate; -- (void) configureWithMessage:(Message *)msg; +- (void) configureWithMessage:(Message *)msg selectable:(BOOL)selectable; @end diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index ad1a3a3..f02aa48 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -46,7 +46,7 @@ const NSString *unreadMarker = @"●"; _italicFont = [UIFont fontWithDescriptor:italicFontDescriptor size: 0.0]; } -- (void) configureWithMessage:(Message *)msg { +- (void) configureWithMessage:(Message *)msg selectable:(BOOL)selectable { self.avatar.image = nil; __weak UIImageView *weakAvatar = self.avatar; [[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:msg.user.avatar] callback:^(NSData *data) { @@ -101,6 +101,8 @@ const NSString *unreadMarker = @"●"; self.text.attributedText = nil; if (msg.text) { [self.text setHidden:NO]; + [self.text setSelectable:selectable]; + [self.text setUserInteractionEnabled:selectable]; NSMutableAttributedString *txt = [[NSMutableAttributedString alloc] initWithString:msg.text attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody], diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index 5b5ebd3..e690318 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -1,16 +1,16 @@ - + - + - + @@ -49,9 +49,9 @@ - + - + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. -- cgit v1.2.3