Refactoring Code Out Of ViewController
Instagram Firebase
In this section, I'd like to go ahead and teach you how to implement a multi-line text input component for our CommentsController page. Another issue we have to fix is the input area being rendered underneath the bottom home indicator bar. I'd like tackle the implementation of this feature by first showing you how to refactor our input accessory view into a separate class CommentInputAccessoryView. Once we have our code refactored out, it'll make our task of implementing our multi-line input much easier. This is because having our code isolated into a different component makes the project much easier to understand and navigate.

Comments (14)
Hoàng Cửu Long
5 years ago
Hi Brian, When do you create a full instagram firebase application?
Brian Voong
5 years ago
Hoàng Cửu Long
5 years ago
Hi Brian, I love this course very much, I'm mid-senior ios developer though. Can you record a video of notification list screen? I think it'll make the application more completely. Thanks <3
edison1
5 years ago
Brian it's been 7 months, we need an update please.
anuj01112
5 years ago
Hi Brian, Could you please provide logic/steps how you are lazy loading the assets using photo framework?
salar Soleimani
5 years ago
Hi Brian, what happened to your head ? i just wanna say that thanks for the bonuses that u make for us... <3
Mauricio Figueroa Olivares
5 years ago
Thanks Bryan :D
Stephan Dowless
5 years ago
email me at dowless.stephan@gmail.com if you would like to see videos on how to do home feed pagination, hashtags/mentions, direct messaging, search feed with posts, and more.
David Wu
5 years ago
Hi Brian, I was building an app very similar to YouTube. I'm using inputAccessoryView as well. My inputAccessoryView doesn't show up. I'm using it inside of a view class instead of a UICollectionViewController class. I don't know if that's the reason the inputAccessoryView doesn't show up no matter what... :( I've experimented it with a demo project with UICollectionViewController class and it works like a dream. Do you have some ideas about it?
Jeffrey Chang
5 years ago
can you show us your code?
David Wu
5 years ago
Thanks for your response. I've already figured that out a fews days ago!
PreachOnBerto
5 years ago
Could you explain how you go it to work? I'm currently having the same issue at the moment.
PreachOnBerto
5 years ago
Neither of my textField and submit button are showing. When I try to add the submit button to the container, the app crashes.
PreachOnBerto
5 years ago
Hey Brain, I am unable to display my textfield and button. App is crashing when I do so. Only thing I am able to display is the separator line Need help please
edison1
5 years ago
how do we update the profile image? i've tried various things but nothing works? anyone have been able to figure it out?
Brian Voong
5 years ago
edison1
5 years ago
I guess I have trouble because our firebase image is in a collection view cell. This is what i've tried. lazy var photoImageView: CustomImageView = { let iv = CustomImageView() iv.contentMode = .scaleAspectFit iv.clipsToBounds = true iv.isUserInteractionEnabled = true //iv.addGestureRecognizer(UITapGestureRecognizer(target: self, action: Selector(("changeProfile:")))) var tap = UITapGestureRecognizer(target: self, action: Selector(("changeProfile:"))) tap.numberOfTapsRequired = 1 iv.addGestureRecognizer(tap) return iv }() @objc func changeProfile(sender: UITapGestureRecognizer) { print("tapping profile image") let imagePickerController = UIImagePickerController() imagePickerController.delegate = self imagePickerController.allowsEditing = true present(imagePickerController, animated: true, completion: nil) } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { if let editedImage = info["UIImagePickerControllerEditedImage"] as? UIImage { photoImageView.setImage(editedImage.withRenderingMode(.alwaysOriginal), for: .normal) } else if let originalImage = info["UIImagePickerControllerOriginalImage"] as? UIImage { photoImageView.setImage(originalImage.withRenderingMode(.alwaysOriginal), for: .normal) } photoImageView.layer.cornerRadius = photoImageView.frame.width/2 photoImageView.layer.masksToBounds = true photoImageView.layer.borderColor = UIColor.green.cgColor photoImageView.layer.borderWidth = 4 dismiss(animated: true, completion: nil) }
Brian Voong
5 years ago
edison1
5 years ago
how do I do that? is my approach the correct one? how do I upload the imageURl in database? thanks! love your courses, i just haven't been able to figure this out
Brian Voong
5 years ago
edison1
5 years ago
also, my comments are not displaying correctly
edison1
5 years ago
like all my comments and another users comment are grouped together
Brian Voong
5 years ago
edison1
5 years ago
https://postimg.cc/image/3shwl932l/ Hey Brian, here's the screenshot. As you can see, I made the first comment, and then the other user commented, I then commented again, and at first the comments were showing correctly from top to bottom and then, my comments got grouped together.
sdowless
5 years ago
email me at dowless.stephan@gmail.com if you would like to see videos on how to do home feed pagination, hashtags/mentions, direct messaging, search feed with posts, and more.
tsangaris
4 years ago
I have a question: In your Facebook Messenger course, you tackled comments input in an entirely different way (https://www.youtube.com/watch?v=p8IaS5lmhuM). In this course (Instagram) you use the AccessoryView. Which one is preferred? I just believe that adding your view using autolayout gives you more freedom. Also, you can control your animation. Thanks again for the courses!
GoldenRules
3 years ago
Brian I just wanted to thank you for your great contribution and possibility to learn from a top professional programmer. I started 2.5 years ago my first app and now still learning from you like the first day.
Brian Voong
3 years ago
Dezzy
3 years ago
Hello there my dear friend, this instagram have live video or Live Cam ? please let me know am interested to buy it
HELP & SUPPORT