The template method allow separate the generic method from a detail context(class) via inheritance
Another advantage:
1.Inheritance implementation means that you will know the actual method implement...
分类:
移动开发 时间:
2015-07-22 16:05:50
阅读次数:
140
// 设计一个方法,用来和其他车比较车速,返回车速的差距#import @interface Car : NSObject@property (nonatomic, assign) int speed;- (int)compare:(Car *)newCar;@end@implementation ...
分类:
其他好文 时间:
2015-07-22 01:22:03
阅读次数:
104
#import @interface Car : NSObject{ @public int _wheels; int _speed;}- (void)run;@end@implementation Car- (void)run{ NSLog(@"%d个轮子, 速度为%d的车子跑起来了", ...
分类:
编程语言 时间:
2015-07-21 23:55:00
阅读次数:
178
@interface Car : NSObject{ @public int _wheels; int _speed;}- (void)run;@end@implementation Car- (void)run{ NSLog(@"%d个轮子, 速度为%d的车子跑起来了", _wheels,...
分类:
其他好文 时间:
2015-07-21 23:29:41
阅读次数:
133
//原理,还是调用UIImagePickerController控制器,设置Type为视频 #import "ViewController.h" #import @interface ViewController () @end @implementation ViewController...
分类:
其他好文 时间:
2015-07-21 20:13:36
阅读次数:
129
//原理:调用 #import "ViewController.h" @interface ViewController () @property(nonatomic,weak)UIImageView *photoImage; @end @implementation ViewControl...
分类:
其他好文 时间:
2015-07-21 20:12:49
阅读次数:
102
什么是IMP指针呢? IMP其实就是Implementation的缩写,指向一个方法实现的指针,每一个方法都有一个对应的IMP; 调用一个IMP的方式和调用普通C函数相同,比如:id returnObjc = someIMP(objc,SEL,params...);IMP指针有什么作用呢?...
分类:
其他好文 时间:
2015-07-21 01:11:42
阅读次数:
139
如果学生没有来上课,老师给家长发送通知 1 #import "Parents.h" 2 // #import "Teacher.h" 3 @implementation Parents 4 5 - (instancetype)init 6 { 7 self = [super init]...
分类:
其他好文 时间:
2015-07-20 21:05:39
阅读次数:
91
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; //1.添加一个视图 UIVie...
分类:
移动开发 时间:
2015-07-20 01:04:17
阅读次数:
158
//距离传感器,以注册通知的形式来实现的#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]....
分类:
移动开发 时间:
2015-07-19 21:42:16
阅读次数:
212