Heim > Fragen und Antworten > Hauptteil
代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
groupViewController = [GroupViewController groupTableViewControllerWithDataSource:[GroupDataSource instance]
Delegate:self];
[self addChildViewController:groupViewController];
[_groupView addSubview:groupViewController.view];
}
症状:
成功添加并显示,但tableView 无法滚动到底。怀疑是布局的问题,求教。
天蓬老师2017-04-22 09:01:40
这里要重新设置frame的
- (void)addChild:(UIViewController *)childToAdd withChildToRemove:(UIViewController *)childToRemove
{
assert(childToAdd != nil);
if (childToRemove != nil)
{
[childToRemove.view removeFromSuperview];
}
CGRect frame = childToAdd.view.frame;
frame.size.height = CGRectGetHeight(self.placeHoderView.frame);
frame.size.width = CGRectGetWidth(self.placeHoderView.frame);
childToAdd.view.frame = frame;
self.currentVC = childToAdd;
[self.placeHoderView addSubview:childToAdd.view];
}