//viewDidLoad method declared in RootViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
//Initialize the array.
listOfItems = [[NSMutableArray alloc] init];
//Add items
[listOfItems addObject:@"Iceland"];
[listOfItems addObject:@"Greenland"];
[listOfItems addObject:@"Switzerland"];
[listOfItems addObject:@"Norway"];
[listOfItems addObject:@"New Zealand"];
[listOfItems addObject:@"Greece"];
[listOfItems addObject:@"Rome"];
[listOfItems addObject:@"Ireland"];
//Set the title
self.navigationItem.title = @"Countries";
}
これと
- (void)loadView
{
[super loadView];
self.navigationItem.titleView = [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, 4.0f, 320.0f, 36.0f)] autorelease];
// Prepare the Navigation Item
[(UILabel *)self.navigationItem.titleView setText:@"Font Families"];
[(UILabel *)self.navigationItem.titleView setBackgroundColor:[UIColor clearColor]];
[(UILabel *)self.navigationItem.titleView setTextColor:[UIColor whiteColor]];
[(UILabel *)self.navigationItem.titleView setTextAlignment:UITextAlignmentCenter];
[(UILabel *)self.navigationItem.titleView setFont:[UIFont boldSystemFontOfSize:[UIFont systemFontSize]]];
}
これ
あとこれ
- (HelloController *) init
{
if (self = [super init]) self.title = @"Fonts";
return self;
}
まぁ、initは良しとしても
loadviewの[super loadView]を使わない場合が多々あるのはなぜ?
コメント
コメントを投稿