【问题标题】:Unknown class ingredientLabel in Interface Builder File (xcode 4.2, iOS 5.0)Interface Builder File 中的未知类成分标签(xcode 4.2,iOS 5.0)
【发布时间】:2011-12-13 01:42:38
【问题描述】:

我有一个应用程序,并且我继续得到日志输出:“接口生成器文件中的未知类成分标签。” ...当我加载特定视图时。

成分标签是我在视图中创建的标签。以下是相关代码:

在 DetailViewController.h 中:

@interface QuickGroceryDetailViewController : UIViewController
{
    UILabel *ingredientLabel;
}

@property (strong, nonatomic) IBOutlet UILabel *ingredientLabel;

在 DetailViewController.m 中:

@synthesize ingredientLabel = _detailDescriptionLabel;

- (void)setDetailItem:(id)newDetailItem
{
    if (_detailItem != newDetailItem) {
        _detailItem = newDetailItem;

        // Update the view.
        [self configureView];
    }
}

- (void)configureView
{
    // Update the user interface for the detail item.

    if (self.detailItem) {
        self.ingredientLabel.text = [self.detailItem description];
    }

}

没有发生错误,应用程序运行良好,但我想知道为什么会发生此错误,因为它可能会导致问题发生。谢谢。

【问题讨论】:

    标签: ios4 ios5 xcode4.2


    【解决方案1】:

    检查你是否在该标签的自定义类属性中写了一些东西。

    1. 打开标签所在的xib
    2. 转到身份检查器 (CMD + ALT + 3)
    3. 检查自定义类文本字段,有东西删除它,UILabel将重新建立
    4. 运行代码...执行 loadNib、initWithNib 等时会出现该行。

    【讨论】:

      猜你喜欢
      • 2015-07-11
      • 1970-01-01
      • 2012-11-23
      • 2012-01-11
      • 1970-01-01
      • 2015-05-21
      • 2015-06-09
      • 2015-06-21
      • 1970-01-01
      相关资源
      最近更新 更多