I create a custom UIView
A with a xib file and it can be loaded correctly by:
NSArray *starsNib = [[NSBundle mainBundle] loadNibNamed:@"nibName" owner:nil options:nil];
A *starsView = starsNib[0];
[self.view addSubview:starsView];
Then in my storyboard file, I add this custom view A to the UITableViewCell
's contentView
. When the tableview is loading, I find the custom view A has no subviews which are added in the xib file. I also find when the A's initWithCoder:
returns, it has no child views.
BTW, in the xib file, I have set both the parent view
and file's owner
to the custom view A class.
I'd like to know why this happens and why the subviews are not loaded when initWithCoder:
returns?