iphone - UITableView 还是 UITableViewCell?提示 "Thread 1: Program received signal: "SIGABRT”

标签 iphone cocoa-touch ios

我不明白为什么我的 UITableView 有时不能正常显示。它提示“Thread 1: Program received signal: "SIGABRT".

PS:condTempTableViewCell 是带有 IBOutlet 控件的自定义 UITableViewCell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([indexPath section] == 1)
        return self.condTempTableViewCell;

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    cell.textLabel.text = [condStatusArray objectAtIndex:[indexPath row]];        

    return cell;
}

有什么帮助吗?

最佳答案

先启用nszombie然后找出问题所在

Double-click an executable in the Executables group of your Xcode project.
Click the Arguments tab.
In the "Variables to be set in the environment:" section, make a variable called "NSZombieEnabled" and set its value to "YES".

和自定义单元格

 if ([indexPath section] == 1) {
static NSString *CellIdentifier = @"CustomCell";
  CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
        for (id oneObject in nib) {
            if ([oneObject isKindOfClass:[CustomCell class]]) {
                cell = (CustomCell *)oneObject;
                break;
            }
        }
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
return cell;

自定义单元格返回类似这样的东西

祝你好运

关于iphone - UITableView 还是 UITableViewCell?提示 "Thread 1: Program received signal: "SIGABRT”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5619122/

相关文章:

ios - 超过 100 个用户可以测试 iOS 应用程序的 Beta 版本吗?

iphone - 将 NSNumber 转换为 NSInteger

ios - 如何将按钮放在不会在 iOS 中随表格滚动的 UITableView 上

ios - UITableView 播放音频文件不正确

iphone - 如何以编程方式刷新 UIViewController?

iphone - [AVPlaybackItem fpItem] : message sent to deallocated instance

ios - 注销后获取推送通知的 DeviceToken 并再次登录?

ios - 如何创建具有固定大小的 UIView 子类?

swift - 使用动画更改 rootViewController 时 viewWillAppear/DidAppear 被调用两次

ios - 无法定位或生成匹配的歌唱 Assets Xcode 7.2.1