iOS6/iOS6アプリで複数のストーリーボードとNIBファイルを混在させています。複数のストーリーボード(iOS +メモリ管理)
複数のストーリーボードでメモリ管理はどのように機能しますか? storyboardAを起動する際に
- 私は別のnibファイルに戻す場合は、/別のストーリーボードに行き、storyboardAだけのメモリにそこに滞在していることでしょうか?
- ストーリーボードの "配列"を私はUIViewControllersでナビゲーションコントローラのスタック内のビューの配列を取得できる方法を得ることができますか?
- メモリ管理のために、ストーリーボードをメモリからポップまたは削除できますか?別のストーリーボードに行くと、それを無しに設定しますか?私はnibファイルと混合し、複数のストーリーボードを使用していますなぜ
理由は:
- 私は、複雑な物語のストーリーボードの流れをしたいです。それらをすべて1つの場所に押し込むことは理にかなっていません。
- 最終的に私は多くの人と一緒に作業し、複数のストーリーボードルートを選択するのに十分なバージョン管理をお勧めします。
- NIBファイルは、ストーリーボードがまだ複雑なnibファイル等、多くのプログラムビュー、
私のコードスニペットは
インサイドInitialNibFile.m < - appdelegateから起動されます。ストーリーボードのシーン内でのUIViewControllerビューインサイドここ
- (IBAction)newStoryboardBtnPressed:(id)sender {
[self.view removeFromSuperview]; // here I remove this view from the superview to save memory
UIStoryboard *newStoryboard = [UIStoryboard storyboardWithName:@"NewStoryboard" bundle:nil];
UIViewController *initialSettingsVC = [newStoryboard instantiateInitialViewController];
[self presentViewController:initialSettingsVC
animated:YES completion:nil];
}
、 。私は別のnibファイルに戻す場合
- (IBAction)anotherStoryboardBtnPressed:(id)sender {
// I'm inside a storyboard right now. I'm calling another storyboard.
// can i remove this storyboard before i launch the otherone? will keeping 2 or 3 toryboards in memory cause a memory leak?
UIStoryboard *settingsStoryboard = [UIStoryboard storyboardWithName:@"AnotherStoryboard" bundle:nil];
UIViewController *initialSettingsVC = [settingsStoryboard instantiateInitialViewController];
// i'm going to load this view controller modally
// initialSettingsVC.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
[self presentViewController:initialSettingsVC
animated:YES
completion:nil];
}
本当にありがとうございましたMishieMoo!これは多くの助けとなりました。 –
あなたの質問に答えたら答えを受け入れるようにしてください=) – MishieMoo
天才の答え...いい仕事... –