我有一个名为myClass的类。这个类有TouchesMoved和TouchesBegan定义。iphone - 将东西添加到类方法
这个类被其他3个类使用。但是我需要向这些类中的每一个添加更多的代码,使其与TouchesMoved和TouchesBean方法相同,而不会覆盖已经在其类中的代码。我的意思是,如果我将一个TouchesBegan方法添加到三个类中的一个,它将不会使用该方法的类定义。我希望能够代之以添加代码而不是替换。
例子:
MyClass
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self doStuff1];
}
Object1 based on MyClass
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self doStuff2];
}
时Object1的运行的touchesBegan,它会调用doStuff2也doStuff1,而不是仅仅doStuff2。
这可能吗?
感谢
谢谢,就是这样。 – SpaceDog 2010-10-24 09:38:03