【问题标题】:Delegate Help - Using class the delegate is for inside the delegate委托帮助 - 使用委托在委托内部使用的类
【发布时间】:2013-09-22 17:53:55
【问题描述】:

我将如何在协议方法中使用委托所对应的类。

例如:

@protocol ILMIconDelegate <NSObject>
- (void)deleteIcon:(ILMIcon *)icon;
@end

@interface ILMIcon : UIView <IconPopoverViewControllerDelegate>

...

@end

这不起作用,因为我不能在协议中使用(ILMIcon *),因为它稍后在文件中声明。 有什么帮助吗?

有什么解决方法,还是我应该改用(UIView *)

谢谢

编辑: newacct 给了我在协议之前使用@class ILMIcon; 的答案,它可以工作! 非常感谢!

【问题讨论】:

    标签: iphone objective-c ipad delegates protocols


    【解决方案1】:

    您可以在协议声明之前前向声明该类,例如:

    @class ILMIcon;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 2011-01-12
      • 2013-01-06
      • 1970-01-01
      • 1970-01-01
      • 2013-11-26
      相关资源
      最近更新 更多