I have View
inside ScrollView
. At end side my View I have submit Button
. The Submit Button Constraint are below.
Button Constraint :
Top to superView : 630
Leading to superView : 40
ScrollView Constraint :
Top to superView : 0
Leading to superView : 0
Trainling to superView : 0
Bottom to superView : 0
View (That is inside my ScrollView) Constraint :
Top to superView : 0
Leading to superView : 0
Trainling to superView : 0
Bottom to superView : 0
When I set upper constraint the ScrollView is in normal behaviour means it can scroll top to bottom.
But I when Increase the width of Button
means I want to set Button
from both side 40 constraint. That time ScrollView doesn't scroll.
After Change Button Constraint :
Top to superView : 630
Leading to superView : 40
Traling to superView : 40
Why this happening I don't know ?
Any help be Appreciated.
I have tried it and the following setup works for me fine:
Button Constraint :
Top to superView : 630
Leading to superView : 40
Trailing to superView : 40 (@750)
Bottom to superview: 0
ScrollView Constraint :
Top to Top Layout Guide : 0
Leading to superView : 0
Trainling to superView : 0
Bottom to superView : 0
View (That is inside my ScrollView) Constraint :
Top to superView : 0
Leading to superView : 0
Trainling to superView : 0
Bottom to superView : 0
Width : equal to superview
When you use scrollview an inner view requires all the constraints (top, leading, trailing, bottom). Otherwise scrollview is not able to calculate its content view.