Vertical scrolling not working in UIScrollView and iOS7 and Xcode 5 despite not using Autolayout

ios, objective-c, uiscrollview, xcode

Solution

Here's self answer

I changed `self.myScrollView.contentSize = CGRectMake(320, 1500);` from within `viewWillAppear` to `viewDidLoad`, and run the simulator, then for some reasons the scrolling is working now. As I said in the original post, I first wrote it in `viewDidLoad` and moved it over to `viewWillAppear` after I read kkocabiyik's answer. I'm not sure then why my original code wasn't working - maybe because I slightly modified my code during me getting lots of helps from Mani and Rashad, but kept the above code within `viewWillAppear` at the same time.

For those who would be caught in the same trap and come to this question in the future, I've been able to fix the issue from this settings:

- write `self.myScrollView.contentSize = CGSizeMake(320, 1500);` within `viewDidLoad`

- connect UIScrollView from storyboard to myScrollView as IBOutlet property

- not using autolayout

- set x = 0, y = 0, width = 320, height = 568 to scrollview from within storyboard

And also note that using autolayout doesn't work. Also, using autolayout and setting contentsize within `viewWillAppear` doesn't work, either.

I'd like to appreciate everyone that helps me in this question. Thank you.

Problem

When I tried to use UIScrollView in iOS 7 and Xcode 5, it doesn't respond to vertical scrolling. I first drag and drop ScrollView from object library to storyboard and set its size as width = 320 and height = 1500, and then drag and drop three labels, and locate those labels at y = 300, 800, 1200. For labels whose y coordinate being equal to 800 and 1200, I first move scrollview to the upper to make those objects located at the corresponding y values. Then, I connect scrollview to implementation file as outlet, and in `viewDidLoad` method, I write `self.myScrollView.contentSize = CGSizeMake(320, 1500)`. And finally set back the size of scrollview at width = 320 and height = 568. And then run the simulator, but it doesn't react to vertical scrolling. Then I deselected `use autolayout` and run the simulator again, it's still not working at all. So how can I fix the issue? Or can anyone inform me of any useful tutorials which teach about UIScrollView in iOS 7 and Xcode 5 (this is important, since every tutorial I've read is based on the prior version)? I use Xcode 5.0.2. Thanks.

Original source

Related problems