Graphics Programs Reference
In-Depth Information
UITabBarItem *tbi = [self tabBarItem];
[tbi setTitle:@"Time"];
UIImage *i = [UIImage imageNamed:@"Time.png"];
[tbi setImage:i];
[[self view] setBackgroundColor:[UIColor greenColor]];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"TimeViewController loaded its view.");
[[self view] setBackgroundColor:[UIColor greenColor]];
}
Build and run the application. Switch between tabs and simulate memory warnings. No
matter what you do, the background color of TimeViewController 's view will be
green.
Unloading views
If TimeViewController destroys its view during a memory warning, the view 's
subviews will no longer be able to appear on screen and should be destroyed, too. This is
what will happen with the UIButton ; it is only owned by the view , so when the view
is destroyed, the button is destroyed. However, the UILabel will continue to exist be-
cause it is still pointed to by the timeLabel instance variable of TimeViewCon-
troller . ( Figure 7.17 ).
Figure 7.17 TimeViewController before and after memory warning
 
 
Search WWH ::




Custom Search