Reputation: 5301
I am trying to add a UILabel along with a UIWebView together in a view controller and want them to scroll together. So to accomplish that, i have added a UIScrollView behind these two views but the UIScrollView is just not scrolling. I am using Storyboard and iOS 7 SDK.
I have seen many questions but they are not of much help. Some are suggesting that i should disable the AutoLayout that i cannot do due to the requirements of my project. What else can i do to make it work? Thanks!
Upvotes: 2
Views: 3433
Reputation: 46
According to Apple's documentation, you shouldn't use UIWebView inside UIScrollView. What you can do is to add your UILabels and UIWebView inside aother UIView and then add this UIview inside the UIScrollView.
Secondly, you have to set the contentSize of the UIScrollView in order for it to work.
You also have to disable the scrolling of UIWebView that is embeded inside the UIScrollView.
Still if your problem is not solved. It is better to just turn of AutoLayout. I have had the same issue and i wasnt able to solve it without disable the AutoLayout.
Upvotes: 3
Reputation: 7381
The documentation for UIWebView states:
Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.
You need to wrap the label and web view in a regular UIView. Add the regular view to the scroll view.
Upvotes: 1