Clean Up Memory Leaks
Twitter Slide Out Menu
As we mentioned in the last lesson, we have quite a few views being leaked in our right side red view container. You can spot these leaks by using the Debug View Hierarchy tool in Xcode. In today's lesson, why don't we go ahead and improve the logic in our program to clean up these pesky memory leaks. As a bonus, let me show you a few tips and tricks that can help you identify your views easier in the Debug tool.

Comments (6)
Jeffrey Chang
4 years ago
why don't we just use Typealias instead of creating a empty subclass of UIView?
Jeffrey Chang
4 years ago
nvm it doesn't work that way lol
Michael Zeng
4 years ago
Hi Brian, Correct me if I'm mistaken, but the memory address that stores rightViewController's HomeController doesn't actually get cleared before you create a new HomeController and re-assign it to rightViewController. Also, if I choose case 1 or case 2 on the menu controller without assigning rightViewController to a new viewController, the app essentially freezes and becomes unresponsive. Why is that? Thanks, Michael
Brian Voong
4 years ago
Robin Bindewald
4 years ago
Hey Brian, what is the disadvantage of creating the cell in this one way and not register it and dequeue it ?
Brian Voong
4 years ago
Robin Bindewald
4 years ago
Hey Brian, ok that makes sense. Thank you for your answer.
AlexGold
4 years ago
Hey Brian, I think an easier way of showing all the views being added with the debug view is just to drag it a bit to the side and it'll show all the views in 3D. It's an easier representation as they will show the entire view and not just a title of "UIView"
LucienChu
4 years ago
Hey bro, just a quick note that, this method might work in your case, but did not work in mine. The real problem is that we have no idea what is that UIView being added. I spend hours on that but have no result, end up with redesign the layout since I had no idea what was wrong with my view controller, with a few component only.
malrhex
4 years ago
The title of this video should be, view hierarchy explained haha. Pretty good! even though I had to roll back my application cuz I lost control over my homeVC. Now I can start looking with a sharp eye to the view hierarchy. Thankful
MaxApp
3 years ago
Hey Brian, I had a quick question! Why are you removing the view controller from the Superview if you are just calling addChild. is the removeFromSuperview needed? because you're not adding anything to the Superview
HELP & SUPPORT