2011-03-29 58 views
0
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    // Navigation logic may go here. Create and push another view controller. 

    //Some code to go to the next page 
    NSString *selectedCountry = [arraycountries objectAtIndex:indexPath.row]; 
    NSString *selectedCountry1 = [arycountries objectAtIndex:indexPath.row]; 
    profilepage *detailViewController = [[profilepage alloc] initWithNibName:@"profilepage" bundle:nil]; 

    detailViewController.selectedCountry = selectedCountry; 
    detailViewController.selectedCountry1 = selectedCountry1; 
    // ... 
    // Pass the selected object to the new view controller. 

    [self.navigationController popViewControllerAnimated:YES]; 

    [detailViewController release]; 

這是我的代碼,如何傳遞和SELECTEDCOUNTRY到SelectedCountry1 ,,, profilepageiphone popviewcontroll問題

我嘗試,但我沒有得到任何值,請幫幫我,thnkzzz

+0

你是如何在下一課獲得detailViewController instace的? – PgmFreek 2011-03-29 11:18:27

回答

1

如果detailViewController是下一個視圖,你應該用pushViewControllerAnimated:animated:代替popViewControllerAnimated:。從邏輯上講,推動前進和流行往後退。

導航堆棧在視圖控制器編程指南的Navigation Controllers部分中描述。

[self.navigationController popViewControllerAnimated:detailViewController 
          animated:YES]; 

[detailViewController release]; 
+0

但是,我得到一個警告消息顯示,uinavigationcontroll可能沒有性反應,以popviewcontroller ,,先生,我只是想通過popcontroller方法selecetdcountries和selectedcountry1傳遞到前一頁,,, – 2011-03-30 03:44:46