我有一点问题;我将此协议定义如下:
@protocol someProtocol <NSObject>
- (void) changedStoryForIndexPath: (NSIndexPath *) indexPath;
@end
我在一个名为“ListViewController.h
”的文件中定义了它,逻辑上我必须在另一个文件中导入标题,如:#import "ListViewController.h"
然后在我的@interface
中声明协议中的协议像<someProtocol>
这样的标签对吗?我什么时候编译然后编译,编译器(在Xcode 4.0和3.2.4上)告诉我它找不到协议声明。您可以在此处看到错误:http://www.freeimagehosting.net/uploads/5ff0c99bf7.png
谢谢你们!
答案 0 :(得分:0)
您应该将协议放在不同的头文件中。
SomeProtocol.h:
@protocol someProtocol <NSObject>
- (void) changedStoryForIndexPath: (NSIndexPath *) indexPath;
@end
并将其导入ListViewController类。
#import "SomeProtocol.h"