nav和tabbar设置iOS开发iOS开发点滴

iOS 在一个view上添加Controller视图

2022-07-25  本文已影响0人  小和大大
  1. 在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);
  1. 销毁
[self.chatListVc.view removeFromSuperview];
上一篇 下一篇

猜你喜欢

热点阅读