Using a navigation controller, I am pushing a new view and setting the title of it dynamically:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
int countryIndex = [indexPath indexAtPosition: [indexPath length] - 1];
NSString *selectedCountry = [[countrysData objectAtIndex: countryIndex] objectForKey: @"title"];
scheduleState *scheduleStateViewController = [[scheduleState alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:scheduleStateViewController animated:YES];
scheduleStateViewController.title = selectedCountry;
[scheduleStateViewController release];
CountryData being a mutable array created from an xml feed.
Now when I go to the next view, it displays correctly, however when I try to do an NSLog inside the new viewController, it logs as (null):
NSLog(@"The title is: %@", self.navigationItem.title);
2009-10-27 11:30:20.416 myApp[50289:20b] The title is: (null)
I need to use the title as a parameter for grabbing a web service query...
Any thoughts?