未找到ios类"预期类型"

Jac*_*nkr 2 ios ios5 xcode4.2

我在我身上遇到两个问题,我FooterSelectorView.h不明白为什么.一个是警告而另一个是错误.由于某些原因,xcode无法识别,FooterArchiveItemView因此我无法将对象键入为导致其他问题的对象.有没有人见过这样的事情呢?我该如何解决?

FooterSelectorView.h

#import <UIKit/UIKit.h>
#import "FooterArchiveItemView.h"

@interface FooterSelectorView : UIImageView

// #warning Type of property 'activeItem' does not match type of accessor 'setActiveItem:'
@property (nonatomic, retain) FooterArchiveItemView *activeItem;

// #error Expected a type
- (void)setActiveItem:(FooterArchiveItemView *)activeItem_;
- (void)update;
- (CGPoint)absoluteCenterOf:(UIView *)obj;

@end
Run Code Online (Sandbox Code Playgroud)

相关课程

FooterArchiveItemView.h

#import <UIKit/UIKit.h>
#import "AutosizeableView.h"
#import "FooterArchiveView.h"

typedef void (^ DayBlock)(void);

@interface FooterArchiveItemView : AutosizeableView {
    DayBlock dayBlock;
}

@property (nonatomic, retain) IBOutlet UIButton *day;
@property (nonatomic, retain) IBOutlet UIImageView *bullet;

- (void)setDayBlock:(DayBlock)block;

@end
Run Code Online (Sandbox Code Playgroud)

AutosizeableView.h

#import <UIKit/UIKit.h>

@interface AutosizeableView : UIView

@end
Run Code Online (Sandbox Code Playgroud)

isa*_*aac 9

我建议的一件事是你遵守Obj-C实践,即在头文件接口文件中,而不是导入自定义类,你可以向前声明它们.例如,在FooterSelectorView.h中,而不是:

#import "FooterArchiveItemView.h"
Run Code Online (Sandbox Code Playgroud)

转发声明课程:

@class FooterArchiveItemView
Run Code Online (Sandbox Code Playgroud)

然后,在实现文件(FooterSelectorView.m)中导入.在这种情况下观察实践可能实际上并不能解决您的问题(我不确切地知道发生了什么,我个人希望看到更多的代码来冒险猜测),但它可能有助于为您隔离问题.

此规则的注意例外是Apple的框架 - 这些框架被导入到标题中.