Swift Uiscrollview Amongst Auto-Layout Together With Size Classes

UIScrollView alongside Auto-Layout as well as Size Classes

Influenza A virus subtype H5N1 uncomplicated tutorial on making scrollable sentiment that tin rank the sack adapt whatever covert sizes. Download Link.




1.) First, of course of pedagogy nosotros ask a scrollview. So, drag a scrollview within the storyboard as well as brand certain that its distance from every side is zero.


2.) To brand certain that it volition adapt whatever covert sizes; nosotros convey to pivot all of its side to its superview.  Click the newly added scrollview (just inwards example you lot click somewhere) as well as become to "Editor" -> "Pin" -> "Leading Space to SuperView". Repeat the same procedure for trailing, transcend as well as bottom.

3.) Now nosotros ask a container to display our UI's. So, drag a uncomplicated sentiment as well as brand certain that all of its distance to every side it zero, like to scrollview.

4.) To brand certain that it volition adapt whatever covert sizes the same procedure (2) must hold upwardly done.

5.) Since nosotros merely ask to hold upwardly able to scroll upwardly as well as down, nosotros ask to get its width. Select the newly added sentiment as well as and "control-drag" it to scroll view, as well as and then choose "Equal Widths".

6.) For the height, choose the sentiment as well as "control-drag" it to itself, as well as then choose "Height". You volition hold upwardly given a summit of 580. You tin rank the sack alter its value past times clicking the summit constraint as well as then going to attribute inspector as well as and then changing the "constant" to whatever value you lot want.

 And that is it. You tin rank the sack forthwith construct as well as run the projection to encounter how it works.

Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.