Uiscrollview does not scroll due to auto shutdown

Well, I know that there are already many answers to my questions, but I tested each of them, and I still have a problem. I have a UIScrollView that contains a UIView, I want active autostart for animation. But because of this, my scroll does not scroll.

This is my code:

NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(_scrollView, _containerScrollView); [_scrollView setScrollEnabled:YES]; [_scrollView setContentSize:CGSizeMake(_scrollView.frame.size.width, CGRectGetHeight(_containerScrollView.frame))]; _scrollView.userInteractionEnabled = YES; _scrollView.delaysContentTouches = YES; [self.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_scrollView]|" options:0 metrics:0 views:viewsDictionary]]; [self.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_scrollView]|" options:0 metrics:0 views:viewsDictionary]]; [_scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_containerScrollView]|" options:0 metrics:0 views:viewsDictionary]]; [_scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_containerScrollView]|" options:0 metrics:0 views:viewsDictionary]]; 

Can someone explain to me why it is not working?

+7
ios autolayout uiview constraints uiscrollview
source share
2 answers

Try setting the scrollView Content size method "viewDidLayoutSubviews" while maintaining the autorun set.

 -(void)viewDidLayoutSubviews { [self.itemList setContentSize:CGSizeMake(required_width, required_height)]; } 
+7
source share

I just answered a similar question. https://stackoverflow.com/questions/488778/how-to-create-a-string-sql-sql-sql-sql/sql/sql/sql/sql/sql.html

0
source share

All Articles