I am using Xcode 8, iOS 10. I have Create ScrollView from Storyboard. My Flow is
[self.scrollView addSubview:parentView]; self.scrollView.frame = CGRectMake(0, 0, 320, parentView.frame.size.height); [self.scrollView setContentSize:CGSizeMake(320, parentView.frame.size.height)];
When I print Scrollview height after this code, it shows "680" which is more than My View Height. I have tried with "viewDidLayoutSubviews" Method but still the ScrollView is not working. Does anyone have any idea why It is not scrolling?
The problem in your code is that you are setting the scrollview height and contentSize height from parent view.
You should do as following :-
[self.scrollView addSubview:parentView];
self.scrollView.frame = CGRectMake(0, 0, 320, [UIScreen mainScreen].bounds.size.height);
[self.scrollView setContentSize:CGSizeMake(320, parentView.frame.size.height)];
Hope this will be helpfull