2010-10-22 60 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