Reputation: 6451
In my storyboard I have a label and a UIScrollView subclass with the scrollview constraints placing it directly under the label:
In code I am adding a single view that will have the content:
let contentView = UIView(frame: CGRectMake(0, 0, 2000, 1000))
override func viewDidLoad() {
contentView.backgroundColor = UIColor.whiteColor()
tableView.addSubview(contentView)
}
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return contentView
}
When the scrollView shows, the top is not up against the label:
Why isn't the scrollview up against the label?
Upvotes: 1
Views: 35
Reputation: 77631
Add this to your view controller...
Self.automaticallyAdjustsScrollViewInsets = false
Upvotes: 2