Brewski
Brewski

Reputation: 684

Scroll horizontally in UITableView - Swift 3, iOS

I need to horizontally scroll through a list of thumbnails at the bottom of the screen that shows all the user's recently taken photos / videos.

I created a UIScrollView with a UITableview inside of it.

Is this the correct approach because I can't seem to find an override method in its superclass for scrolling direction? Most of the topics I can find online deals with putting a UIscrollview inside a TableCell, which will not work for my specific application?

The hierarchy is:

View > Scroll View > Table View > Table Cel > Content > PhotoThumbnail

Below is a screenshot of what I'm trying to do: enter image description here

Upvotes: 2

Views: 11602

Answers (2)

Krishna Kumar
Krishna Kumar

Reputation: 1652

I am not really sure why do you want to use UITableView for horizontal scrolling which lay out there cells in vertical manner. If you want horizontal scrolling I would recommend using UICollectionView where cells can be added horizontally or vertically or both. Still if you want tableview to be scrollable in horizontal direction I would suggest you to check this project to get inspiration or using it.

https://github.com/alekseyn/EasyTableView

Upvotes: 9

Aravind A R
Aravind A R

Reputation: 2714

Instead of using UITableView you can use UICollectionView to achieve the desired result i.e, horizontally scrollable cells with imageView and other elements that you need.

Upvotes: 1

Related Questions