1
我有一個tableview
,其中6個單元在view
上可見。總共有10個電池。當我嘗試向下滾動時,模擬器會自動終止併產生異常。有人可以幫忙嗎?目標C中的可滾動表格視圖
我已經多次瀏覽過這個問題,但都沒有成功。
我得到以下異常:
異常 'NSRangeException',原因是: '* - [NSMutableArray的objectAtIndex:]:指數10超越界限[0..1]'
這裏是我代碼的代表方法:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:@"cell"];
if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
}
return cell;
}
請給我們展示一些代碼。 – Mirco
你在委託方法中返回什麼值' - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section' ?? – mohkhan
顯示我們的tableview – NightFury