我正在尝试在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;
}
答案 0 :(得分:0)
设置contentSize
可调整滚动视图滚动的逻辑空间量。您需要设置frame
或bounds
以在其父视图中调整滚动视图的大小。
CGRect scrollFrame = self.scrollView.frame;
scrollFrame.size.height += height + 210;
self.scrollView.frame = scrollFrame;