我有这个大表没有错误的工作,即使我看起来比从下载的例子打开的更复杂的单元格太慢了.问题来自我点击一个单元格,然后回来,在几秒钟内快速滚动应用程序崩溃在该行:charImage.image = [self imageForIndex:ch.charId];
如果我删除它会在下一行崩溃: titleLabel.text = ch.title;
有人熟悉这个吗?谢谢.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//NSLog(@"add a new cell at index path %@", indexPath);
// Each subview in the cell will be identified by a unique tag.
static NSUInteger const kTitleLabelTag = 2;
static NSUInteger const kCharImageTag = 3;
static NSString *kCellID = @"CellID";
// Configure the cell
// Declare references to the subviews which will display the char data.
UILabel *titleLabel = nil;
UIImageView *charImage = nil; …Run Code Online (Sandbox Code Playgroud) 将表中的行数设置为零时,我的UITableView出现一致崩溃。它因EXC_BAD_ACCESS错误而崩溃。崩溃是UITableView的内部问题,所以我无法直接查看出了什么问题,尽管这对我来说应该是一个愚蠢的错误。
堆栈跟踪如下:
#0 0x0194ca60 in objc_msgSend ()
#1 0x00656837 in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] ()
#2 0x0064c77f in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] ()
#3 0x00661450 in -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] ()
#4 0x00659538 in -[UITableView layoutSubviews] ()
#5 0x00d39451 in -[CALayer layoutSublayers] ()
#6 0x00d3917c in CALayerLayoutIfNeeded ()
#7 0x00d3237c in CA::Context::commit_transaction ()
#8 0x00d320d0 in CA::Transaction::commit ()
#9 0x00d627d5 in CA::Transaction::observer_callback ()
#10 0x013a3fbb in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#11 0x013390e7 in __CFRunLoopDoObservers ()
#12 0x01301bd7 in __CFRunLoopRun ()
#13 0x01301240 in CFRunLoopRunSpecific ()
#14 0x01301161 in …Run Code Online (Sandbox Code Playgroud)