将第6个元素插入到表格视图中时,为什么会出现NSRangeException?
|
我将数据插入表视图,如下所示。如果5到6个元素超过6个,则App Crashs并显示错误,则没有问题:
\"Terminating app due to uncaught exception \'NSRangeException\', reason: \'*** -[NSMutableArray objectAtIndex:]: index 11 beyond bounds [0 .. 10]\' \"
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
return [ProductArray count];
}
- (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] autorelease];
}
NSDictionary *aDict = [ProductArray objectAtIndex:indexPath.row];
cell.textLabel.text= [aDict objectForKey:@\"ProductName\"];
return cell;
}
没有找到相关结果
已邀请:
4 个回复
田眯衅
癸痊醒
嘘崇蔡对
臂哦