NSInvocation为假人?
NSInvocation工作原理如何?有没有很好的介绍? 我在理解以下代码(来自Mac OS X的Cocoa编程,第3版)如何工作时遇到一些问题,但同时也能够独立于教程示例来应用这些概念。代码: - (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index { NSLog(@"adding %@ to %@", p, employees); // Add inverse of this operation to undo stack NSUndoManager *undo = [self undoManager]; [[undo prepareWithInvocationTarget:self] removeObjectFromEmployeesAtIndex:index]; if (![undo isUndoing]) [undo setActionName:@"Insert Person"]; // Finally, add person to the array [employees insertObject:p atIndex:index]; } - …