0

我正在尝试在 UICollectionViewCell 内调整 UIScrollView 的大小,但它不会调整它的大小。

-(int)resizeScrollView:(int)height{

    NSLog(@"Before Scroll height %f",self.scrollView.frame.size.height);
    float currentHeight=self.scrollView.frame.size.height+height+200;
    NSLog(@"height %f",currentHeight);
    CGSize size=CGSizeMake(self.scrollView.frame.size.width ,
                           currentHeight + 10 );
    [self.scrollView setContentSize:size];    
    self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    NSLog(@"After Scroll height %f",self.scrollView.frame.size.height);

    return currentHeight;
}
4

1 回答 1

0

设置contentSize调整滚动视图滚动的逻辑空间量。您需要设置framebounds来调整其父视图中滚动视图的大小。

CGRect scrollFrame = self.scrollView.frame;
scrollFrame.size.height += height + 210;
self.scrollView.frame = scrollFrame;
于 2013-04-22T23:40:42.087 回答