2010-10-22 61 views
0

Iam将对象添加到NSMutableArray并在UITableView中显示值。只有NSMutableArray的第一个对象正在显示。我在哪里出错了?UITableView问题

我的代码片段:

-(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; 
} 

回答

0

很难说没有看到您的更多代码。您是否返回了正确的值

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

+0

非常感谢。这是我所做的失误。我只是忽略了这种方法。现在它的工作非常好。 – Swapna 2010-10-22 10:33:44