10 - Scroll Views Recap


Intro

Scroll views are a fundamental aspect of using iOS. They enable many of the other outlets such as Table Views or Collection Views.


Content and Constraints

For using a scroll view, you would usually want to have a content view within the body of your scroll view which contains all your objects. You can simply add constraints (4 corners + w & h) in the add constraint window


Content Size

In a scroll view, if you do not use auto layout to infer the content size values, you should produce the content size values using a content size value.


Content Inset

Content insets solve the problem of having content that goes underneath other parts of the User Interface and yet still remains reachable using scroll bars. In other words, the purpose of the Content Inset is to make the interaction area smaller than its actual area.


UI Scroll View Delegate Methods

Scroll Views have a multitude of delegation methods such as didEndScrolling or scrollViewDidScroll.


Zooming

In zooming a scroll view, the important thing to remember is that the zoom happens on a content piece from the scroll view. Content view for zooming should be a subview of the scroll view itself. You have to set the minimum and maximum of zoom.

Paging

Paging is an interesting and yet simple feature of scroll views. It allows for scrolling an entire page of the scroll view.


Page Controllers

We use page controls to display a number of page content in outlets such as scroll views.


View Re-Usability

Re-usability of UI Views is an important aspect of any good design. Among many methods for re-using a view, adding a XIB and loading it as a nib is only one of the many solutions. Custom XIBs do not have to adhere to the same size as the main screen. They can be longer, wider or shorter.