Archive for the ‘release’ Tag

Custom UIViewControllers, Their Views, and Their Memory Management   4 comments


Download ExampleDifficulty: easy moderate challenging

UIViewControllers serve as backbones in your iPhone or iPad application. Although they are in charge of many other aspects, including user input and output, a task that is somewhat being overlooked is managing memory. In this article, we’ll see how a UIViewController is in charge of its own and its views’ memory footprint, when and how the system can reclaim the memory, and how to control the process. Although this post will benefit all programmers, it relates more to those who manually code their view hierarchy or parts of it, as oppose to relying on Interface Builder and nib/xib files for the job; as your app grows in code size and you learn to write more reusable code, the more relevant this post becomes.

Read the rest of this entry »

Advertisements

What are Properties and how do they work?   2 comments


Difficulty: easy moderate challenging

Properties are a way for programmers to simplify the use – or to perhaps minimize the misuse – of handling instance variables, especially in regard to how their memory management is being done. Although properties support scalar C data variables such as BOOL, int, etc., their strength exhibits while dealing with NSObjects, when memory management becomes an issue. If you ever noticed properties and didn’t quite understand what the heck, than I would start by saying that properties are not so complicated as they seem at first and there is no voodoo happening that makes them work – they are merely a different syntactic notation for what you normally code in Objective-C. Properties modify two aspects of your code: 1) they streamline how users of a class access its variables, 2) they simplify memory management for classes, by minimizing or even omitting implementation details of the variables’ memory management. If the previous sentence or even the entire paragraph were difficult to understand, read it again after finishing the article and then see if it makes sense.

Read the rest of this entry »

%d bloggers like this: