Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Alex Taylor
Alex Taylor
2,758 Points

UI Collection View - Help!

Hi,

I am trying to create a grid like dashboard for an app I am working on and I think UICollectionView is the way to go?. I've only really seen image layout examples of how UICollectionView works, and I think I may be biting off more than I can chew at the moment, as I am finding it difficult to understand how to set it up.

Here is an example of my wireframe for the particular screen - with arrows and questions!

http://i.imgur.com/Fsxbr2L

Is it correct to think I need to set up two sections within the collection view. The top section has one cell, which I need to create a custom collection view cell for. The bottom section has a supplementary header view, and a cell that I need to make another custom collection cell for. This cell will populate as many times as there is data to populate it with.

I have got myself VERY confused, so would really appreciate any help and guidance anyone can give me, or point me in the direction of any similar examples or tutorials.

Thanks, Alex

Alex Taylor
Alex Taylor
2,758 Points

Sorry guys I can't get my wireframe image to display - am working on it!

Hey Alex. Any luck with your wireframe image, or progress on the issue you are facing?

Alex Taylor
Alex Taylor
2,758 Points

Hi Rhys,

No I haven't had any luck, just waiting to hear back from the contact support - not sure what I am doing wrong. I hope to get it sorted soon as I REALLY need some help with the issue I have.

Alex Taylor
Alex Taylor
2,758 Points

OK i have managed to get a link in and looks to be working. Please let me know if working ok. Thanks!

1 Answer

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Why not just setup a custom UIView with all the controls that you need. Why do you think you need a collection view? As the name indicates a collection view is meant for a collection of objects.

Alex Taylor
Alex Taylor
2,758 Points

Hi Amit, Thank you so much for your response. I thought I needed a collection view to handle the data grid on the second section on the screen. Ideally it is a table where rows are added for each golf score posted to show a history of the games, but I thought UITableView wouldn't handle the multiple columns I needed and someone suggested collectionview to me.

So you are saying I can create the table of data without a collectionview or tableview? Are you able to point me in the direction of further resources that would help me understand how to create this?

Many Thanks, Alex

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

In this case you might get away with using a UITableViewController. The top half would be the header view of the table view. Scores is the section header and each individual score is a cell of the table view.