Hi, everyone,
I want to ask a question about the iPhone application. I write a program which will display a table. However, I don't know why I cannot display the navigation title in the table. The following is my code
// code
- (void)viewDidLoad {
[super viewDidLoad];
// control flow, call another user define function and add the items to the table
[self flowControl];
//Set the title
self.navigationItem.title = @"Table Title Hello";
// can see
// NSLog(@"self.navigationItem.title: %@", self.navigationItem.title);
}
The table can only display the item but not the title. Can any one help me?
// ---------- Update 1 --------------
The code in the [self flowControl] will call two functions, both of the function is to add the items, e.g [displayNameArray addObject:@"John Chan"];
// ---------- Update 2 --------------- In my program, the are 2 view controllers.
1) MyViewController
2) SimpleTableView
The first one is used to let the user to enter the information, the second one is used to display the content in table format.
My project name is USERPROJECT
//The following is the content of the .m
#import "MyViewController.h"
#import "USERPROJECT.h"
#import "SimpleTableView.h"
@implementation USERPROJECT
@synthesize window;
@synthesize myViewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
[self setMyViewController:aViewController];
[aViewController release];
UIView *controllersView = [myViewController view];
[window addSubview:controllersView];
// Override point for customization after application launch
[window makeKeyAndVisible];
}
- (void)dealloc {
[myViewController release];
[window release];
[super dealloc];
}
@end
And it is one of the content within the 'MyViewController.m', I use this to switch to the control from the 'MyViewController.m' to 'SimpleTableView.m'
- (void) switchPageShowTable {
NSLog(@"%d: switchPageShowTable", order);
order++;
SimpleTableView *simpleTableView = [[SimpleTableView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:simpleTableView animated:YES];
}
Is it affect the use of the 'self' in the calling title? Thank you very much.