2009-11-03 13 views
0

我有一個非常簡單的參賽表格。按下按鈕後,我需要顯示從該視圖啓動的另外兩個視圖。這是錯誤。我不瞭解錯誤。我以爲我已經宣佈了兩種不同的類型。評論贊賞。iPhoneSDK:從單個視圖內啓動多個視圖?

009-11-03 17:17:29.008 eProcessing-iPhone [34257:207] ***由於未捕獲的異常'NSInvalidArgumentException',終止應用程序,原因:'不支持多次推送相同的視圖控制器實例()」

下面是代碼:

confirmViewController *anotherViewController = [[confirmViewController alloc] initWithNibName:@"confirmView" bundle:nil]; 

//set properties 
anotherViewController.strConfirmation = [request responseString]; 
anotherViewController.strCardNumber = txtCardNumber.text; 
anotherViewController.strExpires = txtExpires.text; 
anotherViewController.strAmount = txtGrandTotal.text; 

[self.navigationController pushViewController:anotherViewController animated:YES]; 


//reset interface 
if([anotherViewController.strApproval compare:@"""Y"] == NSOrderedSame) 
{ 
    txtCardNumber.text = @""; 
    txtExpires.text = @""; 
    txtGrandTotal.text = @""; 
    txtZip.text = @""; 
    txtCCV2.text = @""; 
    txtEmail.text = @""; 
    txtInvoice.text = @""; 
} 

[anotherViewController release]; 


//show signature 
sigCaptureViewController *yetAnotherViewController = [[sigCaptureViewController alloc] initWithNibName:@"sigCaptureView" bundle:nil]; 
[self.navigationController pushViewController:anotherViewController animated:YES]; 
[yetAnotherViewController release]; 

回答

1

也許,你說

[self.navigationController pushViewController:anotherViewController animated:YES]; 

你的意思是

[self.navigationController pushViewController:yetAnotherViewController animated:YES]; 

錯誤是說你不能在導航視圖堆棧上有兩次相同的視圖控制器。

+0

謝謝你的眼睛。 – 2009-11-04 21:52:18

1

你是推了同樣的觀點控制器兩次:

[self.navigationController pushViewController:anotherViewController animated:YES]; 

該錯誤是一個事實,即你正在做制止:

[anotherViewController release]; 

然後幾行後,你正在做的:

[self.navigationController pushViewController:anotherViewController animated:YES]; 
相關問題