私下协商协议
问题说明
有没有办法隐藏来自最终用户的协议符合?我将尝试详细描述我想要的。我有类让我们称之为 EndUserClass ,它符合一些协议,让我们说 HiddenClassDelegate 和我想从最终用户隐藏的协议。代码如下所示:
Is there any way to hide protocol conforming from an end user? I'll try to describe in details what I want. I have class let's call it EndUserClass which conforms some protocol let's say HiddenClassDelegate and this protocol I'd like to hide from end user. The code looks like as it follows:
@interface EndUserClass : NSObject <HiddenClassDelegate>
{
// .....
}
@end
并且我想使用以下声明保持相同的功能:
and I want to keep the same functionality with the following declaration:
@interface EndUserClass : NSObject
{
// .....
}
@end
有没有办法私下符合协议?我知道我可以在类声明中跳过委托,但它给出了我不想要的编译器警告
Is there any way to conform the protocol privately? I know that I can skip delegate in class declaration but it gives compiler warning which I don't want to have
正确答案
通过在实现文件中声明自定义类类别来实现:
You can do that by declaring custom class category in implementation file:
// .m file
@interface EndUserClass() <HiddenClassDelegate>
@end
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfkjgk
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20