UIScrollView不滚动到最后?

时间:2015-06-29 03:47:06

标签: ios objective-c uiscrollview contentsize

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    CGFloat w = self.contentScrollView.bounds.size.width; 
    CGFloat contentoffSetx = self.childViewControllers.count * w;
    self.contentScrollView.contentSize = CGSizeMake(contentoffSetx, 0);
}

我在self.contentScrollView上有一些UIViews。但我无法将self.contentScrollView滚动到self.childViewControllers.lastObject.view

self.contentScrollView.contentSize不够大?

1 个答案:

答案 0 :(得分:0)

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    CGFloat w = [UIScreen mainScreen].bounds.size.width;

    CGFloat contentoffSetx = self.childViewControllers.count * w;

    self.contentScrollView.contentSize = CGSizeMake(contentoffSetx, 0);
}