Profile Header and Grid Cells
Instagram Firebase
In this lesson, I'll dedicate some time to show you how you can render how our header using various tricks with UIStackView. Finally, when we're done, we'll take a look at how to create the grid of cells for our UserProfileController. Some bit of calculation regarding the pixel spacing is necessary to arrive at the correct layout of cells.

Comments (48)
johnrm9
6 years ago
You might find this interesting ... fileprivate func setupBottomToolbar(){ let stackView = UIStackView(arrangedSubviews: [gridButton, listButton, bookmarkButton]) stackView.distribution = .fillEqually // default axis is .horizontal addSubview(stackView) stackView.anchor(leftAnchor: leftAnchor, bottomAnchor: bottomAnchor, rightAnchor: rightAnchor, height: 50) // Add a thin light gray line to the top and bottom of the stack view [UIView(), UIView()].enumerated().forEach { // $0 is the index = 0 or 1 and $1 is the view self.addSubview($1) $1.backgroundColor = .lightGray $1.anchor(topAnchor: $0 == 0 ? stackView.topAnchor : stackView.bottomAnchor, leftAnchor: self.leftAnchor, rightAnchor: self.rightAnchor, height: 0.5) } }
johnrm9
6 years ago
Oh, I like this better ... fileprivate func setupBottomToolbar(){ ... // Add a thin light gray line to the top and bottom of the stack view [stackView.topAnchor, stackView.bottomAnchor].forEach { let v = UIView() self.addSubview(v) v.backgroundColor = .lightGray v.anchor(topAnchor: $0, leftAnchor: self.leftAnchor, rightAnchor: self.rightAnchor, height: 0.5) } }
Brian Voong
6 years ago
johnrm9
6 years ago
Thanks! I put that code into an extension: class UserProfileHeader ... fileprivate func setupBottomToolbar() { let stackView = UIStackView(arrangedSubviews: [postsLabel, followersLabel, followingLabel]) ... // Add a thin light gray line to the top and bottom of the stack view stackView.dividingLines() } extension UIView { public func dividingLines(backgroundColor: UIColor = .lightGray, height: CGFloat = 0.5) { [self.topAnchor, self.bottomAnchor].forEach { (topAnchor) in let v = UIView() v.backgroundColor = backgroundColor self.addSubview(v) v.anchor(topAnchor: topAnchor, leftAnchor: leftAnchor, rightAnchor: rightAnchor, height: height) } } }
Fred van Rijswijk
6 years ago
I get some strange error when I follow this code as in the video, with some other model override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return users.count } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { return 1 } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { return 1 } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: view.frame.width, height: 94) } override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! PeopleListCell cell.user = users[indexPath.item] return cell } 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
Brian Voong
6 years ago
Fred van Rijswijk
6 years ago
Yeah.... pffff What was wrong with me ;-) hoping for 2 lessons today ;-)
Jesus Adolfo
6 years ago
I still don't get how you use just a positive value for the paddingRight.. I have to use a negative value and didn't see you multiplying or making it a negative value when you built the extension
Brian Voong
6 years ago
Stephen Novotny
6 years ago
Very nice I like how you setup UICollectionView without helper class's such as LBTA Components (although its very nice) or IGListKit (https://github.com/Instagram/IGListKit). I have used LBTA components in the twitter app. I would like to investigate IGListKit latter. PS I use SnapKit as I cant stand the verbose way of setting up autolayout natively in swift. As SnapKit is so widely used you may consider introducing it into some tutorials latter as it saves a lot of typing and is very easy to use and I can see from the comments that some ppl have a hard time with autolayout.
Brian Voong
6 years ago
Stephen Novotny
6 years ago
Brian I totally agree with your recommendation of not using third party libs if possible. Its one of the reasons I really like this Instagram Course. Your teaching techniques and not using storyboards has really made me like xcode/swift ios development.
Sid
6 years ago
Is there any chance the "user" is a reserved keyword in Xcode?
Brian Voong
6 years ago
dirkkarger
6 years ago
Firebase 4 reserve User, Database, Storage, Auth, etc.
Tom Shanks
6 years ago
Not in swift, but as dirkkarger pointed out it is now reserved by Firebase, therefore you have to replace the struct User to something else. I just replaced it to struct MyUser and it all worked fine but this is something that a newbie might not spot.
Sid
6 years ago
This line of code header.user = self.user When I cmd click the user in self.user, it takes me to the code below. I probably did something wrong. /* If the URL conforms to rfc 1808 (the most common form of URL), the following accessors will return the various components; otherwise they return nil. The litmus test for conformance is as recommended in RFC 1808 - whether the first two characters of resourceSpecifier is @"//". In all cases, they return the component's value after resolving the receiver against its base URL. */ @property (nullable, readonly, copy) NSString *host; @property (nullable, readonly, copy) NSNumber *port; @property (nullable, readonly, copy) NSString *user; @property (nullable, readonly, copy) NSString *password; @property (nullable, readonly, copy) NSString *path; @property (nullable, readonly, copy) NSString *fragment; @property (nullable, readonly, copy) NSString *parameterString; @property (nullable, readonly, copy) NSString *query; @property (nullable, readonly, copy) NSString *relativePath; // The same as path if baseURL is nil When I cmd and click the user, I somehow got here.
Casey West
6 years ago
Can you let me know how to navigate out of the profile header for the 'edit profile' button? I can't access the present function from the customer collectionview cell. Anything helps
Brian Voong
6 years ago
Casey West
6 years ago
Awesome, sorry for premature asking. i'll work through the rest of the project...but glad to hear it made it in :)
Pavel Bogart
6 years ago
I was working on Xcode 9 And noticed that there are some changes when setting NSMutableAttributedString Here is what I changed and now it is working fine for me: The new version: let attributedText = NSMutableAttributedString(string: "0\n", attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 14)]) attributedText.append(NSAttributedString(string: "following", attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray, .font: UIFont.systemFont(ofSize: 14)])) label.attributedText = attributedText Just in case to save some time for others who will be looking for that in the documentation :)
code_seeker
6 years ago
You're a lifesaver. Worked like a charm
Redoine Aito
6 years ago
thank you
AhmedSeddek
5 years ago
thanks :)
Duc Vu
5 years ago
thanks
TTTTgg
6 years ago
Hi Brian, Is there a way to present or push to a new View in a non-controller file, like in the UserProfileHeader.swift This is not the controller file so I cannot use present or pushView to redirect to a new view. As I try to open a new window when click edit profile button. Thanks,
Brian Voong
6 years ago
Fabio Giolito
6 years ago
Hi Brian, I have a suggestion: it would be helpful to have a download link with all the assets at the beginning of the course so we don't need to keep downloading the project at each stage and dig for the assets.
luccaccine
6 years ago
Excellent. It's my suggestion too.
smiller193
6 years ago
Is anyone having an issue with the input accessory view getting stuck at the bottom? When exiting comment screen
Mickaz89
6 years ago
Hi someone can help me ? I try to do the same thing just i work with Table view controller and not Collection view , so i have : let cell = tableView.dequeueReusableCell(withIdentifier: "userInfo", for: indexPath) as! UserProfilCell cell.user = self.user return cell and in my UserProfilCell i have also var user: User? { didSet { titleLabel.text = user?.fullName } } but they don't show me anything , in my view controller in my function fetch user when i try to change the navigation title item , that's work , but in the cell anything
Brian Voong
6 years ago
Mickaz89
6 years ago
Update , this is my code in the table view controller override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 0 { let cell = tableView.dequeueReusableCell(withIdentifier: "userInfo", for: indexPath) as! UserProfilCell cell.user = self.user return cell } var user: User? fileprivate func fetchUser() { guard let uid = Auth.auth().currentUser?.uid else { return } Database.database().reference().child("users").child(uid).observeSingleEvent(of: .value, with: { (snapshot) in print(snapshot.value ?? "") guard let dictionary = snapshot.value as? [String: Any] else { return } self.user = User(dictionary: dictionary) self.navigationItem.title = self.user?.fullName }) { (err) in print("Failed to fetch user:", err) } } } struct User { let fullName: String let profileImageUrl: String init(dictionary: [String: Any]) { self.fullName = dictionary["Fullname"] as? String ?? "" self.profileImageUrl = dictionary["profileImageUrl"] as? String ?? "" } } And this is my code in the UserProfilCell import UIKit import Firebase class UserProfilCell : UITableViewCell { var user: User? { didSet { titleLabel.text = user?.fullName } } private let coverImageView: UIImageView = { let imageView = UIImageView() imageView.layer.cornerRadius = 25 imageView.clipsToBounds = true return imageView }() private let titleLabel: UILabel = { let label = UILabel() label.text = "Full Name" return label }() Thank You for your help
Mickaz89
6 years ago
All my app based on TableViewController i need to know how to fetch data with TableView Cell
Adam El-Kadi
5 years ago
Why would you use table view controller, cell view is more efficient and easier to use?
Adam El-Kadi
5 years ago
Hey Brian, can you please help with this. Whenever I press the button edit Profile it then changes to follow or unfollow. Which is really weird can you please just tell me how to stop that from happening and how to acctually allow them to edit profile.
Brian Voong
5 years ago
Adam El-Kadi
5 years ago
Makes sense, thank you Brian :)
Robert Barta
5 years ago
Hey Brian! I'd just like to know why we are subclassing UICollectionViewCell for the UserProfileHeader. Is there a specific reason for this? Or would an UIView be enough? Thanks for your awesome videos! best regards
Brian Voong
5 years ago
Robert Barta
5 years ago
Ok! Thank you very much for the quick response. :)
Harrison Tran
5 years ago
Hey, can you explain why the editProfileFollowButton is anchored to postsLabel? Shouldn't it be anchored to the entire stackview of userStats?
Harrison Tran
5 years ago
Also, why are you not making stackviews member views so they can be used for anchoring? This is my first time developing in iOS so I'm just alittle confused.
Brian Voong
5 years ago
Tokyojogo
5 years ago
What do you mean by member view / member property? Also, I think its wrong for you to say "in a production project I will do it this way..." because that is kinda what we want/expect you to teach us.
Nick Vaughn Kang
5 years ago
Really helpful video! Curious what you meant by "member property"? Thanks, Nick
Tokyojogo
5 years ago
Hi Brian, in setting up the views - profileImage -> bottomToolbars -> username -> UserStatsView -> editProfilebtn. Why did the bottomToolbar come second and not last? Is there an order we should follow?
Brian Voong
5 years ago
Tokyojogo
5 years ago
Hi Brian, i have a question on stackviews. so similar to what you did, i have a horizontal stackview with 3 cells in it. if I have images on each cell, how can i make the left image stay on the leftmost side and the right image stay on the rightmost side? I'm doing .fillequally and all images are being centered in their own cells. Also, I have an image setup as circular but I can't get it to display? How can I do that inside stackviews? Thank you.
Brian Voong
5 years ago
Tokyojogo
5 years ago
Nevermind. I was able to find a solution. Thanks.
Tokyojogo
5 years ago
Oh sorry, the page didnt update. Didn't see your reply before I sent my reply. Will check what you suggested too and see how it works.
Tokyojogo
5 years ago
Thank you Brian. I actually did that but for the centerExpandingView, I added widthAnchor.constraint(greaterThanOrEqualToConstant: 0).isActive = true do I still need that?
Tokyojogo
5 years ago
Hi Brian, I have another question on stackviews. In one cell, I have a colored circular view(size 16) but the cell height is size 25 (because its the height needed in the next cell). how do I maintain my circular view? Right now its expanding to the size of the cell, its not displaying as a circle? Would you know how to handle this? Thank you.
Brian Voong
5 years ago
Tokyojogo
5 years ago
Hi Brian, Here's the link to the image... https://www.dropbox.com/s/wctix035o2u0o5s/Screen+Shot+2018-01-04+at+10.31.53.png?dl=0 Thank you.
Tokyojogo
5 years ago
Here's the code I'm working on... lazy var myLocCircle: UIView = self.setupLocCircles(with: UIColor.myLocColor, borderColor: UIColor.myLocBorderColor.cgColor) fileprivate func setupLocCircles(with color: UIColor, borderColor: CGColor) -> UIView { let view = UIView() view.frame = CGRect(x: 0, y: 0, width: 16, height: 16) view.layer.borderWidth = 1.5 view.backgroundColor = color view.layer.cornerRadius = view.frame.width / 2 view.layer.borderColor = borderColor return view } fileprivate func setupInputView() { myLocCircle.widthAnchor.constraint(equalToConstant: 16).isActive = true myLocTextField.widthAnchor.constraint(greaterThanOrEqualToConstant: 0).isActive = true let stackView = UIStackView(arrangedSubviews: [myLocCircle, myLocTextField]) stackView.axis = .horizontal stackView.distribution = .fill stackView.spacing = 10 stackView.alignment = .fill locInputView.addSubview(stackView) stackView.anchor(top: locInputView.topAnchor, left: locInputView.leadingAnchor, bottom: nil, right: locInputView.trailingAnchor, paddingTop: 10, paddingLeft: 10, paddingBottom: 0, paddingRight: 10, width: 0, height: 25) }
Tokyojogo
5 years ago
Hi Brian... Have you had the chance to look at the image and code? Thank you.
Brian Voong
5 years ago
Tokyojogo
5 years ago
Ok Thanks. So for future reference, if the image/view is smaller than the cell in the stackView, this isn't possible and should be done outside of stackView? Thank you.
Tokyojogo
5 years ago
Hi Brian, I have a question on refactoring. I have this code: let requestBtn: UIButton = { let btn = UIButton(type: .system) btn.setTitle("SIGN IN", for: .normal) btn.setTitleColor(UIColor.btnTextColor, for: .normal) btn.titleLabel?.font = UIFont(name: "SFProDisplay-Bold", size: 22) btn.backgroundColor = .white btn.layer.cornerRadius = 5 btn.layer.shadowRadius = 10.0 btn.layer.shadowColor = UIColor.shadowColor.cgColor btn.layer.shadowOpacity = 0.3 btn.layer.shadowOffset = CGSize.zero return btn }() but when I refactor it to : class RoundedShadowButton: UIButton { var originalSize: CGRect? override func awakeFromNib() { super.awakeFromNib() setupButtonView() } func setupButtonView() { originalSize = self.frame //to capture the original size of the button setTitle("SIGN IN", for: .normal) setTitleColor(UIColor.btnTextColor, for: .normal) titleLabel?.font = UIFont(name: "SFProDisplay-Bold", size: 22) backgroundColor = .white layer.cornerRadius = 5 layer.shadowRadius = 10.0 layer.shadowColor = UIColor.shadowColor.cgColor layer.shadowOpacity = 0.3 layer.shadowOffset = CGSize.zero } } then set let requestBtn: RoundedShadowButton = { let btn = RoundedShadowButton(type: .system) return btn }() It doesn't work when I refactor it and I can't figure out why. Would you know what I'm doing wrong Brian? Thank you.
aryasaatvik
5 years ago
Shouldn't the reuse identifier for cellId be in "" like "headerId"
Brian Voong
5 years ago
frankcrest
4 years ago
i tried doing that but either due to scope or whatever reason, the let method didnt work
timboehm
5 years ago
Hey Brian. I cannot figure out from the video or the code, how you get the purple post squares to fall directly below the UIStackView that contains the postsLabel, followersLabel, and followingLabel. Mine slide underneath and I don't see any anchor for the collectionView. Any help would be appreciated.
Brian Voong
5 years ago
Amit
5 years ago
Hi Brian, As per my requirement i need to put AVPlayer in the header section. Is it ok to do so? I am facing lot of problems with Avplayer especially in landscape mode (iphone x). Hope you can address this in your youtube application. Thank you
ozgunsimsek
5 years ago
Hi brain. You are creating collection view cells 3 by 3 and you determine the width " (frame.width - 2) / 3 " Thats look great but there is some issue. For example, you run this in iPhone 7 simulator (width : 375) . And cell width will be "(375-2)/3" = "124,3". that means width will be 124. then we have 3 cell(124px) and 2(1px) separator. 124*3 + 2*1 = 374. so we have 1px extra space between first and second cells. space between first and second cells is 2px, space between second and third cells is 1px... Maybe its not so weird but some times Xcode round this width to up. and last cell goes down... I am using that way for fixing this but that is so weird. let width = (frame.width - 2) / 3 if indexPath.row != 2 { return normal width } else { return (view width - (2 * width.round(.down)) } so my first cell has 124px width, second one has 124px and last one has 125px and I have two 1px separator. do you have any better idea ? sorry if you talked about that in next episodes.
Norlan
5 years ago
This fix for me func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { return 1 }
cyn89110
4 years ago
This is how I solve this problem, to inset one pixel for middle cell. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let width = collectionView.frame.width let itemWidth = width / 3 if itemWidth.truncatingRemainder(dividingBy: 1) == 0{ if indexPath.row % 3 == 2{ return CGSize.init(width: itemWidth - 2, height: itemWidth) } return CGSize.init(width: itemWidth, height: itemWidth) } // Unable to divisible let floor = Int(itemWidth) let ceiling = Int(itemWidth) + 1 if indexPath.row % 3 == 2{ return CGSize.init(width: floor - 2, height: ceiling) } return CGSize.init(width: ceiling, height: ceiling) }
cyn89110
4 years ago
indexpath.row should plus one.
aps17
5 years ago
Hi Brain, My profileImageView is showing rect even though I have set the layers. The original color shows rounded but it resets to rectangle when the image loads.
Brian Voong
5 years ago
Pren22
5 years ago
Hey Brian, I am currently getting crashed when anchoring. It says unable to activate anchors becuase there are no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That’s illegal
Brian Voong
5 years ago
GriffDawg15
5 years ago
Hey Brian, I am currently getting only the cells shown in order (as many can fit on each row). I have the code to divide by 3 so there only rows of 3, but the code doesn't seem to be doing anything. Do you know why?
GriffDawg15
5 years ago
I fixed the problem by re-copying the UserProfileController code. However, my code seemed to match yours before perfectly, so I'm a bit confused.
Brian Voong
5 years ago
jayrsonani
5 years ago
hey brian you tell me use this code but problem is logoImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true logoImageView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true You'll want to follow this example and modify the code accordingly. but problem is xcode error xcode error is = Use of unresolved identifire 'view' so what i do brian. please solved this error i use this code is in userprofilecontroller file so error is = Use of unresolved identifire 'view' so please brian solved this please.... please...
Brian Voong
5 years ago
jayrsonani
5 years ago
so what i do sir please tell me please
jayrsonani
5 years ago
sir i want have center in profileimageview so sir int this code is possible profileImageView.anchor(top: topAnchor, left: self.leftAnchor, bottom: nil, right: nil, paddingTop: 12, paddingLeft: 12, paddingBottom: 0, paddingRight: 0, width: 80, height: 80) ?? you chagne the perameters and send code again and thanks
jayrsonani
5 years ago
sir i want have center in profileimageview so sir int this code is possible profileImageView.anchor(top: topAnchor, left: self.leftAnchor, bottom: nil, right: nil, paddingTop: 12, paddingLeft: 12, paddingBottom: 0, paddingRight: 0, width: 80, height: 80) ?? you chagne the perameters and send code again and thanks
jayrsonani
5 years ago
sir i want have center in profileimageview so sir int this code is possible profileImageView.anchor(top: topAnchor, left: self.leftAnchor, bottom: nil, right: nil, paddingTop: 12, paddingLeft: 12, paddingBottom: 0, paddingRight: 0, width: 80, height: 80) ?? you chagne the perameters and send code again and thanks please fast
Joe Langenderfer
5 years ago
Hey Brian, how do I change the navigation bar title to a different font (ex. Futura)?
Brian Voong
5 years ago
darren100
5 years ago
Hey Brian! I know this may be silly but at 4:11 you set the stackview's bottom anchor equal to the bottom of the cell view. oh nevermind it just popped into my head. If anyone else is confused, it's cause the stackView's code is being written inside the headerCell so the bottom of the stackview will sit on top of the bottom of the headerView.
joeypozzyclinch
5 years ago
Hi Brian! Thanks so much for making this course, it's really insightful! I'm sure it's something fairly obvious that I'm missing since it's not in the comments already, but the stack view with the listButton, gridButton and bookmarkButton is appearing at the top of the header when I run it in the simulator. I tried turning off the bottom anchor and setting the top padding to 120, so it doesn't seem to be anything in the anchor call. Any idea on what I might be doing wrong? Or if it has something to do with the Xcode update since the lesson was put up? Thanks in advance!
Sebbie
5 years ago
Same here! If you download the project, you can follow the video along with the updated code. However looking at the updated file doesn't seem to show any difference :/
joeypozzyclinch
5 years ago
I actually figured it out! It turned out I misspelled something in the bottomAnchor section of the ORIGINAL anchor function all the way back when we created it early on. Give that a try, hopefully it helps!
shubhamsaurav
5 years ago
I am enjoying this course so much. Just wanted to know about your upcoming course.
Pat Trudel
5 years ago
Hey Brian, Upon trying to anchor the topDividerView & bottomDividerView, I run into some issues. This is how I am anchoring them: stackView.anchor(top: nil, left: leftAnchor, bottom: self.bottomAnchor, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 50) topDividerView.anchor(top: stackView.topAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 0.5) bottomDividerView.anchor(top: stackView.bottomAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 0.5) Although the dividers end up as shown in the picture below https://ibb.co/fFfDn8 Please let me know what I am doing wrong, I tried to download and build your project but the same issue arises. Is this an Xcode update? or have I made a mistake elsewhere Thank you
Brian Voong
5 years ago
Pat Trudel
5 years ago
I just realized now that if I comment out that whole usernameLabel section, My dividers appear as they should, Please see image attached https://ibb.co/erH4uo Thank you
OfftheCode
5 years ago
Can U pls provide full code for those view or maybe whole file? That would help a lot.
OfftheCode
5 years ago
If anyone has trouble positioning icons in header bottom bar consider playing with stackView.alignment property and set to center for example. example: stackView.alignment = .center
saberso
5 years ago
Hi Brian, I have a general question about coding your view items inside your ViewController classes. Doesn't that infringe against the MVC architecture pattern of separating the view from the controller? Doesn't that become a pain later on in the project?
Brian Voong
5 years ago
rickkettner
5 years ago
Looks like the button structure can also be applied to the stackView when refactoring. Are there any performance drawbacks or other issues with using this approach here? let stackView: UIStackView = { let sv = UIStackView(arrangedSubviews: [gridButton, listButton, bookmarkButton]) sv.axis = .horizontal sv.distribution = .fillEqually return sv }()
hudsonpereira
5 years ago
Great job
landahoy55
4 years ago
Hi Brian, I’ve reached this far into the course and am itching to refactor a little bit, such as breaking out the view creation and networking, possibly introduce some unit tests if I can get my head around mocking Firebase objects. Is this the right thing to do at this stage of the course, or will I come unstuck as the lectures move forward? Keep up the good work!
flashtrend
4 years ago
If I am not using navigation bar on top, how can i get my header to start from the screens edges rather than under the status bar
Brian Voong
4 years ago
flashtrend
4 years ago
Thanks for the reply! Could I just change the color of the status bar, and how would I do that?
Brian Voong
4 years ago
diegoseb
4 years ago
Hi Brian, Can headerView's height be adaptable to its content? (e.g. If I add a label for Bio sometimes it may have 1 or 2 lines...) In this case, Is autolayout be a good approach or does it have to be reset once the content is set with something like layoutIfNeeded()? Thank you :)
Brian Voong
4 years ago
BTol Mohammad
4 years ago
Hi Brian, how can I change the number of posts added to real data instead of the dummy? Thank you
Daniel Peach
4 years ago
What are these called? let label: UILabel = { let label = UILabel() return label }() I want to look up and read more about them, but I can't find them anywhere bc I don't exactly know what to call them
Brian Voong
4 years ago
frankcrest
4 years ago
How come my bottom bar(list,bookmark,grid) get attached to the top of header bar even though it is anchoring the header's bottom bar?
frankcrest
4 years ago
I had to do this stackView.anchor(top: usernameLabel.bottomAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 40, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 50). instead of stackView.anchor(top: nil, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 50). why is it that I cannot anchor the bottom of stackview to bottom of of header's bottom?..i had to anchor it with the nameLabel..
Brian Voong
4 years ago
aldo3
4 years ago
Awesome lesson
Cinquain
4 years ago
Fire!
omarubilla
3 years ago
Hi Brian, I've scoured the internet but can't find a solution for the 'observeSingleEventOfType' fix. I am on the latest xcode as of 2019. Is it a pods issue? Thank you for your time and dedicated feedback. (I think you've already encountered this but if not ask for more error details and I'll provide, thanks)
Brian Voong
3 years ago
HELP & SUPPORT