9to5ios
9to5ios

Reputation: 5555

Uitableview with UICollectionviewcell and UITableviewcell

i need to create below design

enter image description here

I am following this code to draw simple collection view with horizontal scroll inside a UITableView

Current sample code work like this

UITableView-> UICollectionViewCell as cell with horizontal scroll

What i want

i want : First row with UICollectionview with horizontal scroll and Then rest row with Normal UITableviewCell to show data

How can i do it .

Upvotes: 0

Views: 793

Answers (3)

Rakesh Mandloi
Rakesh Mandloi

Reputation: 361

When tableview's cellForRowAtIndexPath call you can check for First section and when first section load you can create new UICollection view object load in first cell. Than next section will load you can work as normal tableview work.

Not- you need to implement UICollectionview delegate and datasource methods also.

Upvotes: 1

caldera.sac
caldera.sac

Reputation: 5108

  1. add a UITableView to your view controller and implement it's delegate and datasource methods .(You can use UITableViewController instead of UIViewController).
  2. for the fist cell of the first section in your tableview, you should use a custom tableview cell.
  3. Inside this custom tableview cell, you have to add your collection view with horizontal scroll, and implement its delegate and data source methods inside your custom tableview cell class.

these are the steps you have to do.

refer this implement uicollectionview inside uitableview question for more.

Hope this will help to you.

Upvotes: 2

user4993619
user4993619

Reputation:

You should design a UITableViewCell which has a UICollectionView inside, and set this cell for the cell in section A and for Section B, you should design a new UITableview cell.

Upvotes: 1

Related Questions