I laid out a view in a NIB file, then added my UIView subclass as the file owner.
The subclass looks like this:
@property (nonatomic, weak) IBOutlet UILabel *categoryLabel;
@property (nonatomic, weak) IBOutletCollection(UIImageView) NSArray *images;
The properties are weak because of this: https://stackoverflow.com/a/7729141/1016515
Then I wired up the label and the UIImageViews in the nib, from the view to the file owner.
Then, in the awakeFromNib part of the subclass, I did this:
[[NSBundle mainBundle] loadNibNamed:@"CategoryButton" owner:self options:nil];
NSLog(@"label: %@",self.categoryLabel);
NSLog(@"images: %@",self.images);
I expected to see the addresses of the categoryLabel and the images. Instead I found that the category label was fine and the images are nil.
This is quite puzzling, because the declarations for images and categoryLabel are identical. Why does one work and the other fail?