我想很多开发者都尝试过这一点 MainStoryBoard 加载许多 UIViewController 对于xib或使用NIB方法,有以下解释:
MainStoryBoard
UIViewController
主存储板
UIView控制器
LoginViewController
HomeViewController
LoginViewController.xib
LoginViewController.swift
家庭视图控制器
您需要覆盖 使用编码器初始化 object-c类中的方法。
if ((self = [super initWithCoder:aDecoder])) { [self addSubview:[[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] objectAtIndex:0]]; } return self; }
有关详细信息,请单击此链接
Add subview from a xib or another scene with storyboard