Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些 IBActions,比如
-(IBAction) doAdd; -(IBAction) doEdit;
我想将它们添加到 NSArray 以将其作为函数的参数传递给某个类。我正在尝试
myArray=[[NSArray alloc] initWithObjects:doAdd, doEdit, nil];
但它不适合我。有什么办法可以吗?
方法不是对象。您不能将方法添加为对象。您可以做的是添加一个指向该方法的指针,然后像这里显示的那样使用它。