How do I pass multiple parameters in Objective-C?

I have read several of the post about Objective-C method syntax but I guess I don’t understand multiple names for a method.

I’m trying to create a method called getBusStops with NSString and NSTimeInterval parameters and a return type of NSMutableArray. This is how I have constructed the method but it obviously gets errors at runtime:

- (NSMutableArray *)getBusStops:(NSString *)busStop
                                (NSTimeInterval *)timeInterval;

I saw another example with a method:

-(NSInteger)pickerView:(UIPickerView *)pickerView
            numberOfRowsInComponent:(NSInteger)component

I don’t understand why this method has a method name for each parameter. Should I do the same with something like:

- (NSMutableArray *)getBusStops:(NSString *)busStop
                        forTime:(NSTimeInterval *)timeInterval

6 Answers
6

Leave a Comment