简体   繁体   中英

I Still Can't get my UI scroll view to scroll! iOS

So these are the steps I've done.

I dragged a scroll view to my view controller in story board, declared it in the .h file and wired it up.

In the scroll view, I have 6 labels with sizes, (320, 38), (262,72), (300, 38), (285,31), (285,31), (285,31).

The scroll View itself has width of 320 and height of 184.

In my viewDidLoad method, I added :

[self.scroller setScrollEnabled:YES];
[self.scroller setContentSize:CGSizeMake(320,1000)];

What am I doing wrong or missing to make this scroll view scrollable??

EDIT: The viewController is used with Auto-layout.

Give an opportunity for the view layout to complete before calling setContentSize. Move [self.scroller setContentSize:CGSizeMake(320,1000)]; to viewDidLayoutSubviews or viewDidAppear.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM