xib
对应的UIView 提供2个类方法给外界调用
+(instancetype)loginView;
+(instancetype)registerView;
pragma mark --登录xib
+(instancetype)loginView{
return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([MYLoginRegistView class]) owner:nil options:nil] firstObject];
}
pragma mark --注册xib
+(instancetype)registerView{
return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([MYLoginRegistView class]) owner:nil options:nil] lastObject];
}
Controller 中
MYLoginRegistView *loginView = [MYLoginRegistView loginView];
[self.middleView addSubview:loginView];
MYLoginRegistView *registerView = [MYLoginRegistView registerView];
[self.middleView addSubview:registerView];