Objective-C: ModalViewの画面遷移
modalViewの扱いについて理解しきっていないのであまり詳しくは書けないのですが、iOS6以降非推奨となっていてWARNINGの出る、modalViewController系の出し入れの新たな記法です。
まず、modalViewの変更
// 今まで(非推奨) // [self presentModalViewController:testViewController animated:YES]; // これから [self presentViewController:testViewController animated:YES completion:nil];
次に、modalViewを閉じる
// 今まで(非推奨) // [self dismissModalViewControllerAnimated:YES]; // これから [self dismissViewControllerAnimated:YES completion:nil];
ちなみにcompletionというところで、画面遷移が終わった後の処理を記載出来ます。
[self presentViewController:testViewController animated:YES completion:^{NSLog(@"hoge")}];
基本はviewWillAppearやviewDidAppearで処理していれば問題ない気もしますが、何か使えそうです。
詳細! Objective-C iPhoneアプリ開発 入門ノート Xcode5+iOS7対応
- 作者: 大重美幸
- 出版社/メーカー: ソーテック社
- 発売日: 2013/11/02
- メディア: 単行本
- この商品を含むブログ (2件) を見る