Reputation: 382
I tried to implement thorugh this method:
override func viewDidLoad()
{
super.viewDidLoad()
mainScrollView.contentSize = CGSizeMake(self.view.frame.size.width, 530);
// Do any additional setup after loading the view.
}
but then also scrollbar not working properly.
Upvotes: 1
Views: 1131
Reputation: 76
In this case your mistake is you should not give content size. And for automatic scrolling you can do auto-layout constraint.
Upvotes: 1
Reputation: 139
self.scrollView.contentSize = self.scrollView.superview!.bounds.size
Upvotes: 2
Reputation: 19
First, you have set scrollview(0,0,600,600)
Setting the autolayout for scrollview leading,trailing,top,bottom.
Second, you have set contentview inside your scrollview(0,0,600,600)
Setting the autolayout for contentview like leading,trailing,top,bottom.
Third, Setting contentview width is Equal to superview width.
Fourth, Setting contentview height.
It's working perfectly.
Upvotes: 1