I have a custom method that accepts two parameters. I am using this method with several different data sets, of which some only need to have one array passed and other two.. I am wondering if its possible to pass one null if needed?
//method
- (IBAction)startSortingTheArray:(NSArray *)arrayData:(NSArray *)arrayDataB
{
//..
}
Yes, you should be able to pass one null if needed, as long as your implementation is coded to expect it that way. For example:
To make your interface more clean, you could also provide an alternate signature of the method and do something like:
Note that I changed the return type from what you initially posted. You had it declared as an IBAction which should take sender as its argument, not an array as you were passing it. I assume you meant for this to be applied to another function and not really to an interface builder action.