使用導航控制器,我推一個新視圖和動態地設置它的標題:self.title被返回(空)
- (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是從XML提要創建一個可變的陣列。
現在,當我去到下一個視圖,它顯示正常,但是當我嘗試做一個NSLog的新的viewController裏面,它記錄爲(空):
NSLog(@"The title is: %@", self.navigationItem.title);
2009-10-27 11 :30:20.416對myApp [50289:20b的標題是:(空)
我需要使用標題爲抓住一個Web服務的查詢參數......
有什麼想法?
你在推視圖還是視圖控制器?您無法推送視圖。 scheduleState是什麼類? – nduplessis 2009-10-27 15:44:38