I’ve found out about a terrific library that allows you to easily implement useful functionality into your apps such as easier memory management, multi-line segmented controls, a special view allowing users to enter ratings, custom progress bars, and many other utility functions with more being added over time.
Check it out here on Github: TouchCustoms
[Via: Under The Bridge]
Found an excellent set of rules from Matt Gallagher on how to avoid retain cycles in Objective-C.
Uh-Oh A Class Is Still Retained Somewhere…
A problem that can occur in Objective-C is that when you start sharing objects between classes and increasing the retain count you can end up with a situation where one class inherits from another, and then when you want to release the object does not get released from memory because it is being retained by a class lower down the class hierarchy.
One Basic Rule
Now if this all sounds confusing, Matt explains everything well in his article, and has created a set of 5 rules. Ultimately it comes down to one basic rule:
"an object may only retain something indefinitely if it is hierarchically senior. If you don’t know which object is senior, you must work it out before you retain. If there is no clear senior object — you should redesign so that there is."
For a more detailed detailed explanation (with diagrams) be sure to check out: Rules To Avoid Retain Cycles
[Via: Cocoa With Love]
Something I’ve found with talking to programmers new to Objective-C is that most often the most confusing concept is memory management.
The reason for this is because in Objective-C memory is managed in a different manner from the mainstream languages typically taught in school (C/C++/Java), and introduces new concepts such as the retain count, and auto release pools.
Mark Johnson has created an extensive collection of video presentations that provide an in depth explanation of Memory Management in Objective-C. This is definitely worth checking out if you are new to the language or this is something you are not totally clear on.
This is the first video:
You can find the rest of the videos on Mark’s site at:
Memory Management Basics Video Tutorial – Click Here