2013-10-11 31 views
2

我做了一個單視圖項目與故事板,添加了幾個viewcontrollers。 初始的ViewController具有簡單的按鈕,以顯示另一個的ViewControllerpresentViewController不存在

- (IBAction)doPhotoAlbumBtn:(id)sender { 
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main.storyboard" 
                 bundle:nil]; 
    VCDecorations *ieVC = 
    [storyboard instantiateViewControllerWithIdentifier:@"VCDecorations"]; 
    [self presentViewController:ieVC animated:NO completion:nil]; 
} 

我導入的類,連接在IB向右類biecontroller,對的ViewController的權利識別符,並檢查了「使用故事板ID」複選框 ,我覺得我缺少很基本的smth。 幫助我們。 謝謝。

+0

嘗試[self storyboard]而不是UIStoryboard。 –

+0

您是否已將「Storyboard ID」值設置爲chekbox上方的VCDecorations? – null

+0

您可以在使用故事板時使用segue。在這種情況下,您可以使用segue,然後使用prepareforSegue方法從第一個控制器繼續使用segue。 –

回答

1

如果你只是想切換到UIViewController同一故事板裏的電流UIViewController是你可以做這個:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ID"]; 
[self presentViewController:vc animated:NO completion:nil]; 

編輯

要使用一個傳遞數據在completion:block的塊中,爲要傳遞對象的對象添加一個屬性。該塊在動畫完成時執行。

+0

謝謝,它的工作。 但是.. 這似乎不是正確的方式,我試圖通過數據轉發,我不能(嘗試更改提供的VC的標籤文本) – Yevgeni

+0

我沒有回答你的問題,它是成功的,請檢查它是正確的答案。 – Arbitur

相關問題