Reputation: 4986
I just ran across a bit of code that has a method like this:
- (void) AddImage:(NSString *)imageURL: (UIImage *)image{
[imgCache setObject:image forKey:imageURL];
}
Normally I see methods that say:
-(typeReturned)methodParameter1:(Param1Type)name1 Parameter2:(Param2Type)name2{
//do something
}
But this method seems to have omitted the Parameter2. Why does this work?
Upvotes: 2
Views: 74
Reputation: 3122
This is at least uncommon and throws a warning. "imageURL" is not "Parameter2" but "name1". So "Parameter2" is empty. You would call it this way:
[self AddImage:@"eins" :[UIImage imageNamed:@"1.png"]];
I would avoid it :).
Upvotes: 4