我正在尝试将容器内的嵌入内容从tableviewcontroller更改为地图。我尝试搜索它,但是所有问题都与tabview有关,而我没有这样做。我将如何开始这个过程?

我也尝试过

- (IBAction)changer:(id)sender {
    UIViewController *viewController1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc1"];
    container.view = viewController1;
}

但这不起作用

最佳答案

尝试

MyViewController *viewController1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc1"];
viewController1.view.frame = self.container.bounds;

[viewController1 willMoveToParentViewController:self];
[self.container addSubview:viewController1.view];
[self addChildViewController:viewController1];
[viewController1 didMoveToParentViewController:self];

关于ios - 如何使用UIButton更改容器的内容?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17101471/

10-13 04:00