0
我有一个滚动视图,我可以根据滚动视图中的内容动态调整其contentSize。问题在于,在完成所有调整之后,它不会滚动到顶部。我尝试将contentOffset设置为0,0,但这并不奏效。UIScrollView不滚动到顶部
我正在使用故事板..任何想法这可能是什么?
这里是一些代码
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 700)];
[scrollView setBackgroundColor:[UIColor colorWithRed:0.892 green:0.893 blue:0.892 alpha:1.0]];
移动标签
// Move Description Label/Image
self.descriptionImageView.frame = CGRectMake(20, self.importantInfo.frame.origin.y + self.importantInfo.frame.size.height + 20, self.descriptionImageView.frame.size.width, descriptionImageView.frame.size.height);
self.descriptionLabel.frame = CGRectMake(self.descriptionImageView.frame.origin.x + self.descriptionImageView.frame.size.height + 20, self.importantInfo.frame.origin.y + self.importantInfo.frame.size.height + 20, self.descriptionLabel.frame.size.width, self.descriptionLabel.frame.size.height);
// Adjust scroll size so it does not scroll out the content
[scrollView setContentSize:CGSizeMake(scrollView.contentSize.width, description.frame.origin.y + description.frame.size.height + 20)];
你可以打印滚动视图的框架进行调试吗? – 2011-12-28 12:07:09
它是:{{0,0},{320,460}} – Chris 2011-12-28 12:20:58
通过删除scrollview并添加一个新的完全相同的数字...它保持参考的高度为460 .. 。谢谢你的提示!您应该创建一个答案,以便将其标记为已回答。 – Chris 2011-12-28 12:55:20