混淆添加NSCoding到现有的项目(新C)
问题描述:
我正在读一本教程混淆添加NSCoding到现有的项目(新C)
http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-nscoding-and-nsfilemanager
有关使用NSCoding,使我能救我的应用程序数据。在早期的教程修改@interface行看起来像这样:
@interface ScaryBugData : NSObject <NSCoding>
我的意图是在我的代表使用NSCoding,但@interface线已经是这样的:
@interface MyAppDelegate : UIResponder <UIApplicationDelegate>
...
@end
因为我对于Objective-C而言,我不确定如何将这两者合并到同一个.h文件中。 (就此而言,我对语法也不清楚)。
我该如何组合和使用这两个语句?
答
如果一个类遵循多个协议,你可以列出他们commaseperated像
<UIApplicationDelegate, NSCoding>
答
@interface MyAppDelegate : UIResponder <UIApplicationDelegate, NSCoding> {...} ... @end
应该做你想做的,我想。
此无关与代表。 *有多个委托*可能意味着*符合多个协议*。 – 2012-02-01 14:17:08
@Vince对不起,我纠正了答案。 – matzino 2012-02-01 14:19:53
够简单 - 谢谢! – wayneh 2012-02-01 14:22:58