summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/ThreadViewController.m
blob: 3b6854c310473fdc0714ccd34bb3e78eef1e37ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
//  ThreadViewController.m
//  Juick
//
//  Created by Vitaly Takmazov on 24/09/2017.
//  Copyright © 2017 com.juick. All rights reserved.
//

#import "ThreadViewController.h"
#import "NewPostViewController.h"
#import "MessageCell.h"

@interface ThreadViewController ()

@end

@implementation ThreadViewController


-(void) viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"Thread"];
}

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString * cellIdentifier = @"messageCell";
    MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    [self performSegueWithIdentifier:@"replySegue" sender:cell];
}

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqual: @"replySegue"]) {
        Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
        NewPostViewController *postVC = (NewPostViewController *)segue.destinationViewController;
        [postVC setReplyTo:msg];        
    }
}

@end