Madian Malfi
Madian Malfi

Reputation: 610

horizontal scroll view swift xcode

I want to make horizontal scroll view in one of my viewControllers, I will show some icons on that 60 px height view inside my viewController , Something like thisenter image description here

Where that circles are scrollable as there will be more than the shown.

I tried adding scroll view using xcode and add the images inside it but it doesnt seem to work!

Upvotes: 1

Views: 5625

Answers (2)

Sergio
Sergio

Reputation: 82

The best you can do is use a collectionView, add the movement type to horizontal and then a custom collection view cell. Then all you need to do is set the data source and delegate and populate the collection view. Will be the cleanest way to approach it

Upvotes: 2

Henrique da Costa
Henrique da Costa

Reputation: 370

I strongly suggest you to use collectionView, specially if the content is a dynamic content. If it's static and you really want to use scrollView you need to set your constraints properly so the scrollView is able to know what's its size.

To make it easier to set the constraint you can go to the Size inspector and set the Simulated Size to freeform, so you can expand your viewController like so

Image

Upvotes: 0

Related Questions