나는 UITableViewController
이고 UITableView
은 세 섹션으로 정적입니다.cellForRowAtIndexPath는 첫 번째 섹션 이외의 섹션에 대해 nil을 반환합니다.
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] detailTextLabel] setText:@"Stuff"];
[[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]] detailTextLabel] setText:@"Other stuff"];
...
}
첫 번째 줄 섹션 0 벌금 행 공을 채 웁니다하지만 두 번째 라인 (사실상의 첫 번째 이외의 다른 부분에 대한 cellForRowAtIndexPath 호출) 반환 : 그래서 같은 viewWillAppear
내 정적 인 부분을 채우기 위해 노력하고 있어요 무 세포.
[self.tableView numberOfSections] // returns 3 - which is correct
[self.tableView numberOfRowsInSection:1] // return 4 - which is unique and correct for my second section
때문에, 테이블 뷰 올바른 보인다 부분 만이 있습니다
[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1] // nil
나는 매우 혼란 스러워요을 -하지 누구든지 그 원인을 알 수 있습니까?
코드에는 특별한 것이 없습니다. 스토리 보드에 세 개의 섹션이 모두 시작된 상태로 작성된 직선 정적 테이블입니다. 뷰 컨트롤러가 올바르게 UITableViewController를 서브 클래 싱하는 것입니다. 섹션 0을 완벽하게 채울 수 있으며 예상대로 모든 작업을 수행 할 수 있습니다.
도움 주셔서 감사합니다.
두 번째 섹션과 세 번째 섹션을 보려면 스크롤해야합니다. – Nick
고맙습니다. 나는 그것을 지금 시도 할 것이다. – Nick
출구를 사용하는 @jrturton은 완벽하게 작동했습니다. 많은 도움을 주셔서 감사합니다. – Nick