0
UITableView在滚动时崩溃。下面是示例代码..UITableView在滚动时崩溃
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"Total Count: %d",count);
return [ObjectArray count] ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont fontWithName:@"Arial" size:12.0];
cell.detailTextLabel.font = [UIFont fontWithName:@"Arial" size:10.0];
[cell.textLabel sizeToFit];
[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
}
// Configure the cell.
NSLog(@"Row Number %d", indexPath.row);
cell.textLabel.text = [ObjectArray name];
return cell;
}
在控制台中,我可以看到总计数= 22
Row Number 0
Row NUmber 1
.
.
Row Number 21 (This row number will pull the last object from ObjectArray)
现在,如果我尝试滚动它崩溃了......为什么?谁能帮我这个...
请正确重新格式化您的代码并发布崩溃的堆栈跟踪。 – 2011-01-25 22:25:25
你还可以提到更多关于ObjectArray的信息。目前ObjectArray正在被使用,就像它不是一个数组。即。 [ObjectArray name] ...不从数组中拉出任何对象 – martinws 2011-01-25 22:31:58