TFPopup
TFPopup copied to clipboard
Xib加载view问题
Xib加载view。尺寸超出范围
xib对象创建好以后需要手动给它设置一下frame,origin的值设为0,宽高设为你实际的宽高就可以了
#pragma mark - Life Cycle Methods
- (instancetype)initWithCoder:(NSCoder *)aDecoder{ self = [super initWithCoder:aDecoder]; if (self) { [self initSelf]; } return self; }
- (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { [self initSelf]; } return self; }
#pragma mark - Tools Methods
#pragma mark - Building SubViews Methods
- (void)initSelf{ [[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; [self addSubview:self.ContentView]; [self.ContentView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(UIEdgeInsetsZero); }]; } 可以把xib 的View变成contentView然后直接设置frame 或者动态计算高度。