object-c 学习小记
2010-08-03 14:48
141 查看
leibie
申明
@interface NSString(NumberConvenience)
-(NSNumber *)lenthAsNumber;
@end
实现
@implementation NSString(NumberConvenience)
-(NSNumber *)lenthAsNumber{
unsigned int length = [self length];
return ([NSNumber numberWithUnsignedint : length]);
}
@end
正式协议
申明
@protocol myprotocol
-(id) someprotocol : (NSString *)zone;
@optional
-(void)method1;
@required
-(void)mthod2;
@end
采用
@interface myClass: NSOject<myprotocol, otherprotocol>
{
}
@end
特性
申明 @property(attributes) type name;
@interface myclass : someclass
{
int someproperty;
}
@property int someproperty;
@property float otherproperty;
@end
实现
@implementation myclass
@synthesize someproperty;
@synthesize property1 = otherproperty;
@end
申明
@interface NSString(NumberConvenience)
-(NSNumber *)lenthAsNumber;
@end
实现
@implementation NSString(NumberConvenience)
-(NSNumber *)lenthAsNumber{
unsigned int length = [self length];
return ([NSNumber numberWithUnsignedint : length]);
}
@end
正式协议
申明
@protocol myprotocol
-(id) someprotocol : (NSString *)zone;
@optional
-(void)method1;
@required
-(void)mthod2;
@end
采用
@interface myClass: NSOject<myprotocol, otherprotocol>
{
}
@end
特性
申明 @property(attributes) type name;
@interface myclass : someclass
{
int someproperty;
}
@property int someproperty;
@property float otherproperty;
@end
实现
@implementation myclass
@synthesize someproperty;
@synthesize property1 = otherproperty;
@end
相关文章推荐
- Uiautomator 2.0之UiObject2类学习小记
- java ObjectInputStream学习小记
- 设计模式学习—传输对象模式(Transfer Object Design Pattern)
- python的学习小记
- Object-c 学习之面向对象的理解
- R-FCN:Object Detection via Region-based Fully Convolutional Networks论文部分总结学习
- 【深度学习:目标检测】RCNN学习笔记(6):You Only Look Once(YOLO):Unified, Real-Time Object Detection
- JavaScript中的Object对象学习教程
- PDO(PHP Data Object)学习
- 数论学习小记 其之一 基础数学
- 【学习笔记】String.valueOf(object obj)和object.toString()以及String(object)之间有什么异同?
- Object-Oriented Analysis and Design Using UML 翻译与学习 (六)
- ExtJs 4.x 学习小记:解决FormPanel的submit提示下载文件
- Android学习小记------Android应用框架简介
- 原根学习小记
- (2011.10.19-2011.11.15)二十八天的学习小记
- Scala 学习之 Class,Object, Trait
- js 正则学习小记之匹配字符串优化篇
- Andrew Ng 深度学习课程小记
- python3学习笔记1--TypeError: 'dict' object is not callable的解决