add UIViewController in subview

后端 未结 9 2236
情深已故
情深已故 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条回答
  •  一个人的身影
    2020-12-14 20:51

    I've try to use this code:

    SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:nil bundle:nil];

     secondViewController.view.frame = CGRectMake(0, 0, self.mySubView.bounds.size.width, self.mySubView.bounds.size.height);
    
     [self addChildViewController:secondViewController];
     [self.viewDialogSolution addSubview:secondViewController.view];
    

    but I see only myview not the layout of secondViewController.

    Ho to resolve the probleam?

    Thanks a lot

提交回复
热议问题