이 문제의 원인은 무엇입니까?그룹화 된 UITableView는 단 한 번만 표시됩니다.
IB에 추가 한 그룹화 된 tableView가 있습니다. 2 그룹. 각 그룹에 3 행.
내 앱을 처음 실행하면 잘 표시됩니다. (그래서 나는 내가 뭔가를하고 있음을 알고있다. 나는 최소한 (위임자, 데이터 소스, IBOutlet 및 연결이 올바르게 설정되었음을 의미하지 않겠는가?)
하지만 내가 호출하는 버튼을 클릭하면 그냥 충돌합니다.
처음에는 그룹 수, 행 수 또는 내 dataSource (단지 작은 NSMutableArray
)의 데이터 변경으로 인해 발생했다고 생각했습니다.
아무런 데이터도 바꿀 때도 같은 일이 발생합니다. 처음으로 tableView가 제대로 표시되면 잘 작동합니다. 하지만 [myTable reloadData]
으로 전화하면 충돌이 발생합니다. (데이터가 변경되었는지 여부)
나는 최소한의 베어 본 (barebones) 코드를 제거했다.이 버그를 찾으려고 노력했다.
-(IBAction) reloadTable:(id)sender { if(myTable == nil) NSLog(@"myTable is nil"); else [myTable reloadData]; }
여기에 "오류"입니다 (전혀 도움) : 여기
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIndentifer = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIndentifer]; if(cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIndentifer] autorelease]; cell.textLabel.text = @"Left Test"; cell.detailTextLabel.text = @"Right Test"; return cell; }버튼 클릭 코드의
[Session started at 2010-02-19 10:04:14 -0100.] GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 1081. kill kill quit The Debugger has exited with status 0.(gdb)
나도 해봤 하드 코딩 " 그룹 수 ","행 수 ","머리글 텍스트 ","발 텍스트 "및"셀 텍스트 "가 있습니다. (objectAtIndex를 계산할 때 잘못된 수학 연산이 발생하거나 충분한 원소가없는 array-dataSource가 있습니다.)
항상 동일한 문제가 발생합니다. 처음에는 문제가 없습니다. 데이터를 다시로드하려고하면 충돌이 발생합니다.
버튼 클릭 방법과 정확한 오류 표시. – DyingCactus
StackOverFlow : * 제 코멘트를 다시 포맷하십시오. * 주석에 html을 금지하십시오. * 내 의견을 "매우 짧게"제한하는 것을 중단하십시오. 으. – Susanna