如何在容器视图中加载表视图(另一种情况)?

时间:2015-02-25 07:07:29

标签: ios objective-c uitableview view uisegmentedcontrol

我希望在分段控件的索引发生变化时更改容器视图。我尝试在之前设置/更改容器:

-(void)viewDidLoad {
    [super viewDidLoad];

    ResMainViewController *newVC = [[ResMainViewController alloc]initWithClassName:@"ResMainViewController"];
    [self addChildViewController:newVC];

    // Add the new view controller view to the ciew hierarchy
    [self.containerView addSubview:newVC.view];

    // End the view controller transition
    [newVC didMoveToParentViewController:self];

    // Store a reference to the current controller
    self.containerView = newVC.view;
}

然而,这不起作用。我可以从tableView接收日志,但tableview(单元格)中没有任何内容。我什么都没有错过?请帮助!!!

0 个答案:

没有答案