开发者

Trying to import a custom UITableViewCell keeps giving me a file not found lexical preprocessor error in Objective-C

Trying to import a custom UITableViewCell and it keeps giving me a file not found lexical preprocessor error. I can't figure it out.

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

@synthe开发者_如何转开发size 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

In my UItableviewcontroller.h file I've tried to import as @class and not doesnt seem to make a difference. and in my implementation file i simply

#import "ProductCell.h"

why is this? what basic step am I missing. Importing it in implementation file should solve my issue. Tried cleaning project


Renaming the header file to something else and renaming it back to its original name did solve the problem for me.


This appears to be an XCode4 bug. Despite the fact that the compiler shows an error, if you try running the project, it should work.

This is discussed in the Apple forums in the following places:

  • https://devforums.apple.com/message/369278#369278
  • https://devforums.apple.com/message/379512#379512
  • https://devforums.apple.com/message/382662#382662
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜