Fork me on GitHub

2012年2月23日

摘要: OK, I found in the code sample from Apple, man use the NSAssert3, so I think I really need to google the meaning of NSAssertX, because somewhere man use NSAssert1, somewhere man use the NSAssert3, or others, So I find the explain for that from the page:http://gnu.ethz.ch/debian/gnustep-base/gnustep- 阅读全文
posted @ 2012-02-23 16:06 pengyingh 阅读(1231) 评论(0) 推荐(0)
摘要: sMemberOfClass方法是来确定对象是否是某一个类的成员。在下一个任务中,我们使用这个方法来验证一个特定的对象是否是一个特定的类成员例子:#import<Foundation/Foundation.h>#import<stdio.h>@interfaceClass1 : NSObject{}-(void)print;@end@implementationClass1-(void)print{printf("This is Class1 .\n");}@end@interfaceClass2 : NSObject{}-(void)prinf;@ 阅读全文
posted @ 2012-02-23 12:35 pengyingh 阅读(7311) 评论(1) 推荐(1)
摘要: 小常识:可以在使用的数据类型中为实例变量和方法指定协议名称。这样,可以给Objective-C的编译器提供更多的信息,从而有助于检查代码中的错误。-(void)setObjectValue:(id<NSCopying>)obj ; 编译器知道,你期望任意类型的对象,只要其遵守该协议。@protocol NSCopying-(void)copyWithZone:(NSZone*)zone;@end@protocol NSCoding-(void)encodeWithCoder:(NSCoder*)acoder;-(id)initWithCoder:(NSCoder*)aDecoder 阅读全文
posted @ 2012-02-23 11:57 pengyingh 阅读(486) 评论(0) 推荐(0)

导航