摘要: 1.声明类别@interface NSString (NumberConvenience)-(NSNumber *) lengthAsNumber;@end该声明表示,类别的名称是NumberConvenience,而且该类别将向NSString类中添加方法。2.实现类别@implementation NSString (NumberConvenience)-(NSNumber *) lengthAsNumber{ unsigned int length = [self length]; return ([NSNumber numberWithUnsignedInt: length]);}例1 阅读全文
posted @ 2012-09-25 21:55 ValeTu 阅读(155) 评论(0) 推荐(0) 编辑