- 通过代码从xib读取View
DateBoardView *view = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
- view的初始化方法分别为
- (instancetype)init; (不走此方法)
- (instancetype)initWithFrame:(CGRect)frame; (不走此方法)
- (instancetype)initWithCoder:(NSCoder *)coder; (先走此方法)
- (void)awakeFromNib; (后走此方法)
- 通过xib创建View,只走下2个方法
//走下2个方法.且均可正常获取Frame值
- (instancetype)initWithCoder:(NSCoder *)coder;
- (void)awakeFromNib;
网友评论