How to overwrite a convenience constructor the proper way?
- by mystify
For example I want to overwrite from UIButton:
+ (id)buttonWithType:(UIButtonType)buttonType
So I would do:
+ (id)buttonWithType:(UIButtonType)buttonType {
UIButton *button = [UIButton buttonWithType:buttonType];
if (button != nil) {
// do own config stuff ...
}
return button;
}
is that the right way? Or did I miss something? (yeah, I have been overwriting thousands of instance methods, but never class methods ;) )