Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrandon Maldonado Alonso
10,050 PointsWhy my implementation of the UI doesn't work?
Hello guys, I tried to implement by myself the UI almost exactly like the file that passan shared to better understand this course, the problem is that the collection view doesn't appear when I run the app, here is the link: https://drive.google.com/file/d/0B3D8byBTWoOVY1ozcU5ES2FYTEE/view?usp=sharing
3 Answers
Hannah Gaskins
14,572 PointsIt looks like the dataSource wasn't set to the ViewController. You can do this by control dragging from the viewController within the main storyBoard to the yellow circle icon > next click dataSource
Next the cellForItenAtIndexPath method of the UICollectionViewDataSource protocol was coming back as a error. I changed it from the commented out above to the one below without the case and with the reuseIdentifier listed as a string. Check below:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
// let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! ListCollectionViewCell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("ListCell", forIndexPath: indexPath)
return cell
}
Next it looks like there was no data within the UICollectionViewCells and the function that set the color at the bottom was not working. I changed the color within the mainStoryBoard to green and it did display as shown below:
Hope this helps a bit.
Cheers,
Hannah Gaskins
14,572 PointsHey Brandon,
The first thing I would check that the outlets are properly connected.
Additionally I would ensure that the data source conforms to the UICollectionViewDataSource protocol. You can read more about that here:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/
Beyond this, if you could ensure the .xcodeproj FILE (not folder) is connected to the google drive we can check out the whole project as opposed to downloading all the files individually (no one has time for that ?). Also could you clarify which Passan video you are referring to?
With a bit more information here we can help you out ?
Cheers
Brandon Maldonado Alonso
10,050 Pointssorry, I forgot to zip the file, please help :(, all is well connected but please check it, I edited the link in the question and it is now the zip file with the entire project
Hannah Gaskins
14,572 PointsHi Brandon,
Thanks for posting entire project.
Could you clarify which video/ tutorial you are referring to from Passan?