1

当我尝试运行我的项目时发生了一个奇怪的错误。我正在重新设计我的旧设置,它是一个专用的 UITableViewController。我正在将它移到一个标准的 UIViewController 中,里面有一个 UITableView 。

我收到此错误:

Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool failed with exit code 255

我缩小了确切的原因,但我不知道为什么。当我尝试将 tableview 中的 UITableViewCell 设置为我创建的自定义 UITableViewCell 类时,就会发生这种情况。请记住,我对原始 UITableViewController 使用了完全相同的设置。为什么构建失败并出现 Storyboard 编译器错误,因为我将 UITableViewCell 设置为自定义子类?

编辑 1 添加相关代码:

。H

@interface SingleCodeViewController : UIViewController <GADBannerViewDelegate, UITableViewDelegate>


@end

.m

@interface SingleCodeViewController ()

// Connected to the table view in IB
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation SingleCodeViewController


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 0, 300, 30)];

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 300, 30)];


    switch (section) {
        case 0:
            label.text = @"Date";
            break;
        case 1:
            label.text = @"Rate";
            break;
        default:
            break;
    }

    label.font = [UIFont boldSystemFontOfSize:17];
    label.shadowColor = [UIColor blackColor];
    label.shadowOffset = CGSizeMake(1.0, 1.0);

    label.textColor = [UIColor whiteColor];
    label.backgroundColor = [UIColor clearColor];

    [view addSubview:label];


    return view;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30.0;
}

// Sets the background for each static cell to be the same custom cell as the table view's.
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([cell isKindOfClass:[CodeCellTVC class]]) {
        if (![cell.backgroundView isKindOfClass:[CustomCellBackground class]]) {
            cell.backgroundView = [[CustomCellBackground alloc] init];
        }
    }
}


@end

我的自定义 UITableViewCell 类:

。H

@interface CodeCellTVC : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *codeTableLabel;

@end

.m

// Empty implementation
4

0 回答 0