Yes, the way Objective-C mixes arguments with parts of a method name seems strange at first. In this regard, everyone goes through a short adjustment period. But give it time - after a while you may not want to ever see a list without name parameters with comma-delimited ones.
In C ++, you would say something like:
Color *color = new Color(0.5, 0.7, 0.2, 0.8);
You know what these meanings mean, right? There are four, therefore, obviously, the parameters are in red, green, blue, alpha order. Or was it alpha, red, green, blue? Of course, it can also be hue, saturation, value, alpha ... well, that doesn't really matter, because you can always just watch it.
In Objective-C, you say:
UIColor *color = [[UIColor alloc] initWithRed:0.5 green:0.7 blue:0.2 alpha:0.8];
Isn't that better? You definitely still need to consult the documentation from time to time to remind yourself what exactly this method does, or what methods the class provides. But you will not often go to the documents to find out which parameter goes there.
Caleb
source share