objective-c - addSubView 添加一个tableView,不能正常滚动
迷茫
迷茫 2017-04-22 08:59:40
0
1
327

代码:

- (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 无法滚动到底。怀疑是布局的问题,求教。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

membalas semua(1)
Peter_Zhu

Anda perlu menetapkan semula bingkai di sini

- (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];
}
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan