2010-10-22 7 views
0

IAM ajout d'objets à NSMutableArray et affichage de la valeur dans UITableView. Seul le premier objet de NSMutableArray est affiché. Où vais-je me tromper?Problèmes UITableView

Mon code snippet:

-(IBAction) segmentedControlIndexChanged:(id)sender { 
int selectedSegment = ((UISegmentedControl*) sender).selectedSegmentIndex; 
switch (selectedSegment) { 
     case 1: { 
     MatchSchedule *semiFinal1 = [[MatchSchedule alloc] initWithDeails:@"20 March"]; 
     MatchSchedule *semiFinal2 = [[MatchSchedule alloc] initWithDeails:@"24 March"]; 
     matchList = [[NSMutableArray alloc] initWithObjects:semiFinal1,semiFinal2,nil]; 
     [semiFinal1 release]; 
     [semiFinal2 release]; 
     break; 
    } 
    default; 
} 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
... 
.... 
MatchSchedule *matchSchedule = [knockoutStage objectAtIndex:indexPath.row]; 
cell.textLabel.text = matchSchedule.matchDate; 
} 

Répondre

0

Difficile à dire sans voir plus de votre code. Renvoyez-vous la valeur correcte pour

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return [knockoutStage count]; 
} 

?

+0

Merci beaucoup. C'est la gaffe que j'avais faite. J'ai juste négligé cette méthode. Maintenant, cela fonctionne parfaitement bien. – Swapna