I have a static tableview controller in storyboard representing a long form. I want to see the different localizations of the scene in storyboard preview, but I am not able to see the cells whose position exceeds the bounds of the actually chosen iPhone screen.
How do I make the tableview scroll in the preview window?
This question also applies to scrollviews.
(I have found similar questions, like How to scroll storyboard preview? or How to scroll UITableView in Storyboard editor of Xcode 5?, but none of them matches my specific question. There is one question that might match mine, but it's too vague to know for sure, and has no answers yet: xcode7 swift storyboard preview not able to scroll.)
To scroll to the top of our tableview we need to create a new IndexPath . This index path has two arguments, row and section . All we want to do is scroll to the top of the table view, therefore we pass 0 for the row argument and 0 for the section argument. UITableView has the scrollToRow method built in.
In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it. A ScrollView supports Vertical scrolling only, so in order to create a horizontally scrollable view, HorizontalScrollView is used.
Controls that scroll must be in focus in IB before they will scroll. Click on the UITableView
or UIScrollView
and then scroll as you usually would.
Also, you can set the view controller's size to Freeform
instead of Inferred
and resize in IB so that everything is viewable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With