diff options
Diffstat (limited to 'Juick/Views')
-rw-r--r-- | Juick/Views/MessageCell.h | 6 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 737ec89..475eea3 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -11,6 +11,10 @@ @import TagListView_ObjC; #import "Message.h" +@protocol MessageCellDelegate +-(void) avatarClicked:(NSString *)uname; +@end + @interface MessageCell : UITableViewCell<TTTAttributedLabelDelegate> @property (weak, nonatomic) IBOutlet UIImageView *avatar; @@ -22,5 +26,7 @@ @property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight; @property (weak, nonatomic) IBOutlet UILabel *summary; +@property (nonatomic, strong) id<MessageCellDelegate> delegate; + - (void) configureWithMessage:(Message *)msg; @end diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 2f00d7e..c304f37 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -28,6 +28,10 @@ self.timestamp.textColor = [UIColor grayColor]; self.summary.textColor = [UIColor grayColor]; self.tags.textFont = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + UIGestureRecognizer *avatarTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarClicked:)]; + [avatarTapRecognizer setEnabled:YES]; + [self.avatar addGestureRecognizer:avatarTapRecognizer]; + [self.avatar setUserInteractionEnabled:YES]; } - (void) configureWithMessage:(Message *)msg { @@ -66,5 +70,9 @@ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } +-(void) avatarClicked:(UIGestureRecognizer *)gestureRecognizer { + [self.delegate avatarClicked:self.title.text]; +} + @end |