我有2視圖parentView和SubView。我叫子視圖從我parentView:在父視圖中顯示值dismissViewControllerAnimated
subView = [self.storyboard instantiateViewControllerWithIdentifier:@"subView"];
[self presentViewController:subView animated:YES completion:nil];
[self.view addSubview:subView.view];
在我的子視圖我有一些功能和一個字符串存儲的值。我想我駁回子視圖後,我parentView顯示在標籤這些值:
[self dismissViewControllerAnimated:YES completion:Nil];
如何傳遞這些值來我parentView和那邊dismissViewControllerAnimated後顯示呢?
你不應該添加subView.view作爲一個子視圖到您的視圖 - 這是不必要的,因爲演示,self.view後無論如何都會從窗口層次結構中刪除。 – rdelmar
你可以使用像(委託,全局變量,通知等)任何ios模式來做到這一點。在代表模式中最適合您的情況。理解委託模式鏈接1 http://www.raywenderlich.com/46988/ios-design-patterns/鏈接2 http://www.tutorialspoint.com/ios/ios_delegates.htm – Pawan