Where is My Object Retained?

For those new to Objective-C and iPhone development, I want to point out something that might save you some time. Look at the code below:

1
2
3
4
5
6
@interface SomeClass : UIViewController
{
  ..
  UIView *containerView;
  ...
}
1
2
3
4
5
6
7
8
9
10
11
12
13
@implementation SomeClass
...
- (void)loadView
{
  ...
  UIView *uiView = [[UIView alloc] initWithFrame:
     [[UIScreen mainScreen] applicationFrame]];
  self.containerView = uiView;
  [uiView release];
  ...
}
...
@end

Continue reading