Post Cell Details
Instagram Firebase
With our Post cells now correctly being laid out in our UICollectionView, we can now focus on adding in the necessary subview details. In this lesson, we'll go ahead and create the user profile image view, username label, various action buttons, and caption label at the bottom. To fit all these subviews inside of our cells, we'll discuss the proper height to give our cells inside of sizeForItem. A long episode but it's packed with a bunch of useful information.

Comments (25)
kaevin
6 years ago
Thank you for all those cools tricks. Amazing video series!
faraz
6 years ago
Hey Brian, Thanks for the courses. Can you show us how to posts texts like a tweet in addition to photos? Also will you teach us how to send push notifications for our app? Thanks!
juliolocoh
6 years ago
hi Brian can show also how to post a video
tomxue
6 years ago
The way to set option button title to be ••• is so cute and clever! Haha.
slmrspartan89
6 years ago
André Campopiano
6 years ago
Hi Brian, I used to set height cell: let height = view.frame.size.height - topLayoutGuide.length - bottomLayoutGuide.length
AlexKey
6 years ago
Where can I get a hoodie like that :p? Thanks for the video!
omari
6 years ago
Hello Brian, what shall we do of the caption text is pretty long .. How can we dynamically increase the cells heights ? Is it smart to count the characters of the caption text and then to increase the height ? But how can we get do this is HomeController instead of the HomePostCell.. Please wait for your answer.
wasim
6 years ago
Hi brain, what would we do to make the height of caption adjust automatically to caption length. Because it maybe 1 line or 3..5.. i wouldn't know what's the proper height of caption view.
Brian Voong
6 years ago
Philippcalif
6 years ago
But how can i implement it correctly into the sizeForItem Method?
Antonio Di Francesco
6 years ago
Hi Brian, when you set the height anchor of the photoImageView in order for the photo to be squared, why don't you set the height parameter of the anchor fuction to self.frame.width? I did it and it works. May it cause any problem?
Brian Voong
6 years ago
Antonio Di Francesco
6 years ago
Tnx Brian.
nicsgodlike@gmail.com
5 years ago
Hi Brian, On my editor when I type the name of the photo in assets when its autocomplete it only shows the picture. How can it be autocomplete with the name of the picture. Thanks
Brian Voong
5 years ago
nicsgodlike@gmail.com
5 years ago
how come I see all your videos picture with the filename? is that a bug in swift 4?
Brian Voong
5 years ago
Fabio Giolito
5 years ago
I'm going insane trying to make a feed like this where captions have variable height and images have variable height too. Even if I know the height the image is supposed to be beforehand (from API) I can't set it and make it work in landscape… any chance you can make a video about it?
Brian Voong
5 years ago
PatrickVB
5 years ago
Good Day. Do you have a Lesson to create of function from the 'Options Button?' Time code 8:30. Thanks!
AndreaMich
5 years ago
Hey Brian thanks for this course! It's really helpful! I have a question about the layout of the photoImageView: It's difficult to have the edges like a Pinterest pick? I mean I understand that I can increase the padding value of the left and right to have white borders, but there is also a method to have the corner rounded? Sorry for my English
AndreaMich
5 years ago
*pic
AndreaMich
5 years ago
Ok I found your video course about the App Store. if someone else need this information: into the photoImageView: iv.layer.cornerRadius = 16 iv.layer.masksToBounds = true Your courses are the best thanks Brian!
Abhishesh
5 years ago
this was done in the Course before already. eg rounding userProfileImage Ofcourse if you just want little rounding of the corners you keep it below the width/height of the image.
ansonngch
5 years ago
Hi Brian, just checking with you, is there any ways to make the codes less cluttered over at the declaration of objects area?
Aurélien Haie
5 years ago
Hello Brian, I have an issue with the collection view, my cells are mixing their content with each other. I made an app with a controller very inspired by this home feed controller and i have 5 different types of cells with 5 different reuseIdentifier. But when i scroll fast, the cells that are under the same reuseidentifier sometimes mix their content (the image of one cell take the imageHeight of another cell) Is there any method i need to call or any code i need to add to prevent this mix? (I already added prepareForReuse method in the cells code to remove the view elements in order to fix a few bugs) If anyone has the answer, I would be very pleased to hear about it Thank you :)
Brian Voong
5 years ago
Aurélien Haie
5 years ago
Yes, exactly! i already did set the image to nil but in fact the problem was the size of the image. What i did was to remove all the constraints before adding the ones that set the image size, it's pretty much like what you told me but for the constraints. I think i got it how it works now, thanks a lot for your help :)
paul18
5 years ago
Hi Brian, Enjoying the course so far and trying to code into my own app as I follow, however in my app, I don't have the "User" relation to the data and I think this may be why my data is not being returned. The number of rows returned is correct but the image and name are not shown. The data is structured by leagues and teams/clubs - I need to show all clubs/teams within a league so structured the data as: league > league name > club > club detail Any help/advice on why the data is not showing? (If I print the dictionary, I can see the data)
DiegoOruna
4 years ago
If you can print the data, maybe you would set your instance variable as lazy.
Ouen_theara
5 years ago
Hello teacher I really love this course but when I following it very slow I don't know it occur by internet slow or not sometime I need to refresh page to forward again. So can u provide me the easily to practices without online?
Brian Voong
5 years ago
NikolaBG
4 years ago
Hello! Are you covering reporting and blocking posts and users?
Brian Voong
4 years ago
Ahmed.Q
4 years ago
Hello, Would it be possible if you explain how to make the cell size dynamic , because I see it on Instagram , they have maybe three sizes or more. I am really interested in this topic as my project that I am working on now is depending of this, I think this is very useful for everyone as will. I have been following you on YouTube since 2017, you are really great teacher I always recommend your channel, honestly I prefer yours over Ray's .
Brian Voong
4 years ago
Lucrecio909
4 years ago
Updates to xcode10: let attributedText = NSMutableAttributedString(string: "Username", attributes: [NSMutableAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 14)]) attributedText.append(NSMutableAttributedString(string: " Some caption text taht will wrap into the very next line", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 14)])) attributedText.append(NSAttributedString(string: "\n1 week ago", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 14), NSAttributedString.Key.foregroundColor: UIColor.gray]))
ZpecterZ80
4 years ago
Hi Brian, how could achieve the HomeCell collectionview using LBTATools? I'm trying to retake this course using these tools, it's a pretty great library and very useful, thank you very much.
Cinquain
4 years ago
That video is fire!
Clint Larenz Nurse
3 years ago
Any reason why my cell does not change in height based on the caption length?
abreyXo
3 years ago
Hey Brian, Hope you are well! Im getting a crash at 6.19 when you run the app and the username should appear next to the custom image view, but I'm getting a crash that says: Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <NSLayoutYAxisAnchor:0x600003f7d700 "UILabel:0x7fc32463b240'Username'.bottom"> and <NSLayoutYAxisAnchor:0x600003f7d500 "IG.CustomImageView:0x7fc32463b060.top"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.' Im trying to figure it out but I'm struggling as to what I've done wrong, ive looked at the source code but I'm still getting the issue. Thanks and I hope you and your loved ones are staying safe and healthy :)
HELP & SUPPORT