2012-04-25 2 views
0

테이블에 셀을 채우고 화면에 표시해야하는 프로젝트에서 작업 중입니다. 표시 할 표가 있지만 이제 데이터가 셀에 표시됩니다. 내가 중단 점을 사용하여 시도 하고이 메서드는 결코 호출 얻을 것으로 나타났습니다. 메소드 바로 앞에있는 메소드 (numberOfRowsInSection)가 호출됩니다. 어떤 제안?cellForRowAtIndexPath가 호출되지 않습니까?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

     static NSString *CellIdentifier = @"Cell"; 

     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
     if (cell == nil) { 
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
     } 
     Resident *aResident = (Resident *)[appDelegate.residents objectAtIndex:indexPath.row]; 
     cell.textLabel.text = aResident.name; 
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

     return cell; 
    } 

답변

0

TableView에 대한 대리인 및 데이터 소스를 설정 했습니까?

+0

그는 numberOfRowsInSection이 호출되면 ... 설정되어있는 것처럼 보입니다 .... – Mario

+0

dint notice .. 내 나쁜 .. 그래서 numberOfRows/numberOfSections가 0이 반환되어야합니다. – Roshit

+0

당신이 옳았습니다. 0을 반환합니다. 이제 어레이가 왜 0으로 돌아 오는 지 알아 내야 만합니다. - (NSInteger) tableView : (UITableView *) tableView numberOfRowsInSection : (NSInteger) 섹션 { NSLog (@ "Count = % i", [appDelegate.residents count]); return [appDelegate.residents count]; –

0

예, numberOfRowsInSection은 아마 0을 반환합니다. 데이터 소스를 표시하고 표시합니다.

관련 문제