Anders
Anders

Reputation: 2941

Horizontal scrollable view in iOS?

I want to create a view that have the following layout:

       Scrollable
<----------I--------->
           V
------  ------  ------
I 1a I  I 1b I  I 1c I
------  ------  ------
------  ------  ------
I 2a I  I 2b I  I 2c I
------  ------  ------
------  ------  ------
I 3a I  I 3b I  I 3c I
------  ------  ------

Where the center item should be the current selection (almost like a flipped date selection). My first thought was to create three separate UITableView:s, but I wonder if there is a better way. My second thought was to create a UICollectionView. So basically, what would be the best way to achieve the above example?

Upvotes: 1

Views: 230

Answers (2)

limon
limon

Reputation: 3212

UICollectionView seems to be correct way to go for your layout depending on which iOS version you're targeting. So, implementing horizontal UITableView could be crucial. Because,UICollectionView is only available for >iOS 6.0.

So, if you want your app to run on device which has lower iOS 6.0, you're supposed to implement horizontal UITableView. Once, i've followed a nice tutorial from this site.

The idea behind this, implement a UITableView that you can scroll on vertically. Create a custom cell that has a rotated UITableView as a subview.

Upvotes: 1

slysid
slysid

Reputation: 5498

As mentioned UICollections way is the way to go. However you can use horizontal UITableview. I have a sample project in below link on how to create a horizontal UITableview

https://github.com/slysid/iOS/tree/master/Moviepedia

Bharath

Upvotes: 1

Related Questions