Bonjour,

Je suis entrain de me pencher sur une application iOS. Actuellement, j'affiche des donnée issuent d'un fichier json externe dans un tableview.

Lorsque l'on clique sur l'un des éléments de la tableview, on obtient une alerte qui affiche un message.

Mon souhait est de rediriger sur une pageview et d'obtenir les information du cell cliqué.

Merci d'avance

VIEWCONTROLLER M (dONNÉES json : AFFICHAGE DANS UN TABLEAU)
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
- (void)viewDidLoad
{
    [super viewDidLoad];
	
    NSError *error = nil;
    NSData *jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://JSONDATASOURCE/?view=json"]];
    
    id jsonObjects = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
    
    NSDictionary *feed = [jsonObjects objectForKey:@"object"];
    NSArray *entries = [feed objectForKey:@"bookmarks"];
    
    NSMutableArray *titles = [[NSMutableArray alloc] initWithCapacity:[entries count]];
    
    
    for (NSDictionary *item in entries)
    {
        NSArray *keys = [item allKeys];
        
        // values in foreach loop
        for (NSString *key in keys)
        {
            NSLog(@"%@ is %@",key, [item objectForKey:key]);
        }
        
        [titles addObject:[item objectForKey:@"title"] ];
        
    }
    self.tableViewArray = titles;

}
SUITE VIEWCONTROLLER M : AFFICHAGE DUNE ALERTE SUR CLIC DUN ELEMENT DU TABLEAU
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
{
    UIAlertView *messageAlert = [[UIAlertView alloc]
                                 initWithTitle:@"Row Selected" message:@"Sportif sélectionné" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    
    // Display Alert Message
    [messageAlert show];   
    
}