is it safe to write code in -awakeFromNib method on UIView Category.
UIView+XXXXXX.m
@implementation UIView (XXXXXX)
- (void) awakeFromNib {
/* some code here */
}
@end
is it safe to write code in -awakeFromNib method on UIView Category.
UIView+XXXXXX.m
@implementation UIView (XXXXXX)
- (void) awakeFromNib {
/* some code here */
}
@end
The behaviour is undefined, and I would consider it not safe for that reason.
From the Apple docs:
If the name of a method declared in a category is the same as a method in the original class, or a method in another category on the same class (or even a superclass), the behavior is undefined as to which method implementation is used at runtime. This is less likely to be an issue if you’re using categories with your own classes, but can cause problems when using categories to add methods to standard Cocoa or Cocoa Touch classes.
See: