2012年4月27日
摘要: iphone中常用@protocol和delegate的机制来实现接口的功能例如想在A的功能要在B中实现,可以在A中定义一个Protocol,按照Cocoa的习惯,一般它以delegate结尾,熟悉C#的同学应该知道它的意义。其实不论是接口,委托,还是回调函数,本质上都做了一件事情。就是定义了一个操作契约,然后由用户自己来实现它的具体内容@protocolAViewControllerDelegate-(void)func1-(int)func2:(int)arg @end然后要在A中声明一个delegate:@property (weak, nonatomic) id<AViewCon 阅读全文
posted @ 2012-04-27 21:21 老Zhan 阅读(1276) 评论(0) 推荐(0)
摘要: 在使用core Data时出现如题 错误,已在项目中加入了Coredata.framework,最终在stackoverflow上找到答案,原来要在App_Prefix.pch 中加入#import <CoreData/CoreData.h>问题解决!http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project 阅读全文
posted @ 2012-04-27 01:25 老Zhan 阅读(3114) 评论(0) 推荐(0)
摘要: Where a managed object context comes from is entirely application-dependent. In a Cocoa document-based application usingNSPersistentDocument, the persistent document typically creates the context, and gives you access to it through themanagedObjectContextmethod.In a single-window application, if you 阅读全文
posted @ 2012-04-27 00:16 老Zhan 阅读(750) 评论(0) 推荐(0)