更新UIScrollView的内容大小

时间:2015-05-08 05:31:08

标签: ios uiview ios8 uiscrollview contentsize

我有以下代码:

- (void) scrollViewDidEndDecelerating:(UIScrollView *) scrollView
{
float currentEndPoint = scrollView.contentOffset.y + scrollView.frame.size.height;

if (currentEndPoint >= scrollView.contentSize.height)
{
    UIView *parent = [[UIView alloc] initWithFrame:CGRectMake(5.0, 665.0, 310.0, 340.0)];
    parent.backgroundColor = [UIColor whiteColor];
    parent.layer.cornerRadius = 2.0;
    parent.layer.borderColor = [UIColor regularColor].CGColor;
    parent.layer.borderWidth = 1.0f;

    // Increase size of content view
    CGRect newContentView = _contentView.frame;

    newContentView.size.width = _contentView.frame.size.width;
    newContentView.size.height = _contentView.frame.size.height + 340.0;

    [_contentView setFrame:newContentView];

    [_contentView addSubview:parent];
}

但到目前为止滚动视图还没有获得更新的内容视图 如何在此处更新内容视图?

感谢。

0 个答案:

没有答案