iOS 在一个view上添加Controller视图
2022-07-25 本文已影响0人
小和大大
- 在View上添加一个Controller视图
//核心代码,必须先addChildViewController
self.chatListVc = [[ChatListVC alloc] init];
[self addChildViewController:self.chatListVc];
[self.view addSubview:self.chatListVc.view];
self.chatListVc.view.frame = CGRectMake(0, kStatusbarAndNavbarHeight, kScreenWidth, kScreenHeight-kStatusbarAndNavbarHeight);
- 销毁
[self.chatListVc.view removeFromSuperview];