Unable to scroll UIScrollView

I have a UIScrollView in IB associated with a delegate, and with the corresponding referencing point declared in my header:

IBOutlet UIScrollView *scrollView;

And called in my viewDidLoad :

 - (void)viewDidLoad { [super viewDidLoad]; [scrollView setScrollEnabled:YES]; [scrollView setContentSize:CGSizeMake(320, 500)]; } 

It has the correct size and width in IB and the default values ​​in the attribute inspector.

Why can't I scroll it?

EDIT: Also, at the layer level, there is no other representation that contradicts the z-index.

+6
source share
5 answers

Is the content size larger than the scroll frame? This is the only way to scroll.

+12
source

Double check that the content size is larger than the scroll size. If it is bigger, it will scroll.

+6
source

m using Xcode 6 / iOS 8+ now with auto linking turned on, and I had the same problem, first of all, deleting the auto layout doesn’t work at all, so in order to make the scroll scroll vertically, I made sure of the following:

  • The height of the size of the scroll content MUST be larger than the screen height, it almost goes without saying ...
  • Restriction of the top / bottom / left / right scroll view MUST BE Attached, I did this with a storyboard, so the code is not displayed here.

If you want the scrolling to scroll horizontally, make sure that the width of its contents is greater than the width of the screen, another rule applies the same way.

It worked for me, hope this can help someone.

+2
source

I'm not sure the answer to your question was when you asked.

So far, in AutoLayout, the limitations of the settings for viewing scrolls solve your problem.

enter image description here

0
source

enable scrolling

check the box next to "Skolking enabled" and make sure that the content size is greater than the height of the screen

 scrollView.contentSize = CGSize(width: 375, height: <content height>) 
0
source

Source: https://habr.com/ru/post/894599/


All Articles