Actuellement, lorsque je clique sur un élément de la tableview, je suis redirigé vers detailview. Mais je ne sais pas comment récupérer et envoyer message
Avec cela, je reçois la sélection des tableview et j'ai créé un message.
Mais comment puis-je envoyer ce message à detailview et l'afficher?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { LoanModel* loan = _feed.users[indexPath.row]; NSString* message = [NSString stringWithFormat:@"%@ from %@ needs a loan %@", loan.name, loan.username, loan.email ]; }
detailview h :
detailview m :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 // ssDetailViewController.h #import <UIKit/UIKit.h> @interface ssDetailViewController : UIViewController @property (strong, nonatomic) id detailItem; @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; @end
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
40
41
42
43
44
45 // ssDetailViewController.m #import "ssDetailViewController.h" @interface ssDetailViewController () - (void)configureView; @end @implementation ssDetailViewController #pragma mark - Managing the detail item - (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [self configureView]; } } - (void)configureView { // Update the user interface for the detail item. if (self.detailItem) { self.detailDescriptionLabel.text = [self.detailItem description]; } } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self configureView]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
Partager