【发布时间】:2018-12-20 16:54:40
【问题描述】:
我先声明了一个协议,然后使用它。但我收到警告“找不到 LeveyPopListViewDelegate 的协议定义”。 代码如下:
@protocol LeveyPopListViewDelegate;
@interface LeveyPopListView : UIView <LeveyPopListViewDelegate,UITableViewDataSource, UITableViewDelegate,UITextFieldDelegate>
//the content of LeveyPopListView
@end
@protocol LeveyPopListViewDelegate <NSObject>
//the definition for LeveyPopListViewDelegate
@end
如果我首先定义LeveyPopListViewDelegate,我不能在协议中使用LeveyPopListView。
【问题讨论】:
-
Max_:虽然我们过去用委托做的一些事情现在用块做的更好,但有很多理由使用协议。
-
您使用的是哪个版本的 XCode?span>
-
Xcode 版本 4.6 (4H127)
-
没关系...您的代码运行良好,对我来说没有错误(XCode4.6)-我只是在一些旧版本中尝试过,以防发生了变化,但在 4.2 中也可以;-j
-
但奇怪的是,尽管有警告,但它确实有效,对吧?
标签: objective-c protocols