add UIViewController in subview

后端 未结 9 2208
情深已故
情深已故 2020-12-14 20:21

I don\'t know if this is the right key to search \"add UIViewController in subview\". As what you can see in my image ,there are two ViewController, the main and the second

9条回答
  •  -上瘾入骨i
    2020-12-14 20:47

    SampleViewController * sample = [[SampleViewController alloc] initWithNibName:@"SampleViewController" bundle:nil];
    sample.view.frame = CGRectMake(0, 0, self.testView.bounds.size.width, self.testView.bounds.size.height);
    
    [self addChildViewController:sample];
    [self.testView addSubview:sample.view];
    

提交回复
热议问题