objective-c - 尝试导入自定义 UITableViewCell 一直给我在 Objective-C 中找不到文件的词法预处理器错误

标签 objective-c import

尝试导入自定义 UITableViewCell,它一直给我一个文件未找到词法预处理器错误。我想不通。

ProductCell.h

#import <UIKit/UIKit.h>


@interface ProductCell : UITableViewCell {
    IBOutlet UILabel *descript;
    IBOutlet UILabel *productCode;
    IBOutlet UIImageView *prodImage;
}

@property (nonatomic, retain) IBOutlet UILabel *descript;
@property (nonatomic, retain) IBOutlet UILabel *productCode;
@property (nonatomic, retain) IBOutlet UIImageView *prodImage;

@end

ProductCell.m

#import "ProductCell.h"


@implementation ProductCell

@synthesize descript;
@synthesize productCode;
@synthesize prodImage;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc
{
    [super dealloc];
}

@end

在我的 UItableviewcontroller.h 文件中,我尝试导入为 @class,但似乎没有什么不同。在我的实现文件中,我只是

#import "ProductCell.h"

这是为什么呢?我缺少什么基本步骤。在实现文件中导入它应该可以解决我的问题。尝试清洁项目

最佳答案

将头文件重命名为其他名称并将其重命名回其原始名称确实解决了我的问题。

关于objective-c - 尝试导入自定义 UITableViewCell 一直给我在 Objective-C 中找不到文件的词法预处理器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5098384/

相关文章:

ios - NSURLConnection 失败,没有错误

c++ - IOS和windows之间如何建立Tcp连接?

ios - AFNetworking isConcurrent任务如何恢复或暂停

javascript - 如何在 react 页面上正确显示带有对象(来自另一个文件)的数组?

java - "Out-of-the-box"maven项目

ios - 出现错误 [UIImage mutableCopyWithZone :]: unrecognized selector sent to instance

ios - 以编程方式添加的 UIView 的自动布局

Java(初学者): Cannot find symbol in Math class

vb.net - 如何将特殊字符插入 Advantage SQL 数据库?

python - 属性错误 : 'module' object has no attribute 'SMBus'