tags:

views:

14

answers:

1

Iam adding objects to NSMutableArray and displaying the value in UITableView. Only the first object of the NSMutableArray is getting displayed.Where am i going wrong?

My 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;
}
A: 

Hard to tell without seeing more of your code. Are you returning the correct value for

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

?

Joseph Tura
Thanks a lot. That's the blunder i had done. I just overlooked this method. Now its working perfectly well.
Swapna