将类类设置为父类中的委托

时间:2013-05-20 07:39:21

标签: ios objective-c

我有一个名为UIViewController的{​​{1}},我已为此课程EditNoteViewController_iPad创建了一个类别。

此类别包含一些委托方法。

我的setDelegate方法在EditNoteViewController_iPad中,我无法转移到类别类。

现在我收到了关于setDelegate方法的警告,如下所示:

EditNoteViewController_iPad (Operation)

Sending 'EditNoteViewController_iPad *const __strong' to parameter of incompatible type 'id<ZNVideoViewDelegate>' 显示警告的行:

EditNoteViewController_iPad

如何删除此警告?

我的项目工作正常。我只是想删除这个警告。

1 个答案:

答案 0 :(得分:2)

您需要声明您的EditNoteViewController_iPad类符合ZNVideoViewDelegate协议。标题中的@interface应该与此类似:

@interface EditNoteViewController_iPad : UIViewController <ZNVideoViewDelegate>
{...}                                                      ^^^^^^^^^^^^^^^^^^^

编辑:如果您在类别中实现了协议,则需要在设置委托的.m文件中导入该类别的标头,以便编译器知道该类符合协议。

相关问题