1

由于@class等未知类型,有什么方法可以使Xcode编译器警告静音?我在单个 .h 文件中定义了一个可以在整个应用程序中重复使用的类型:

#ifndef Apsiape_InterfaceDefinitions_h
#define Apsiape_InterfaceDefinitions_h

#define COLOR_ALERT_RED [UIColor colorWithRed:1 green:0.3 blue:0.3 alpha:1]
...

typedef enum  {
    BYEdgeTypeNone = 0,
    BYEdgeTypeTop,
    BYEdgeTypeLeft,
    BYEdgeTypeBottom,
    BYEdgeTypeRight
} BYEdgeType;

#endif

我的一个类BYEdgeType在 .h 文件中使用自定义协议的类型:

#import <UIKit/UIKit.h>

@protocol BYPullScrollViewDelegate <NSObject>

- (void)pullScrollView:(UIScrollView*)pullScrollView didScrollToPage:(NSInteger)page;
- (void)pullScrollView:(UIScrollView*)pullScrollView didDetectPullingAtEdge:(BYEdgeType)edge;

@end

我希望我InterfaceDefinitions.h的文件位于班级的 .m 文件中,但是如果我不将其导入班级的 .m 中,Xcode(当然)会抱怨它“需要一个类型”(BYEdgeType)。我怎样才能使这个警告@class-style 静音?

提前致谢

4

1 回答 1

0

协议是否在标头 ( .h) 文件中定义?如果是这样,要#defines在 .h 文件中使用枚举,您必须在该文件中导入带有这些定义的标头.h

于 2013-08-08T00:14:38.597 回答