6

これに関するいくつかの質問を見つけましたが、その回答で問題が解決しません。

presentModalViewController を使用して提示した 2 つのコントローラーがあります。

Main Controller によって呼び出される最初のコントローラーに modalTransitionStyle を追加しました。最初のコントローラーは、2 番目のコントローラーを通常どおり (遷移スタイルなし) に提示しました。

FirstVC *first = [[FirstVC alloc] initWithNibName:@"FirstVC" bundle:nil];
first.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:first animated:YES];

SecondVC *second = [[SecondVC alloc] initWithNibName:@"SecondVC" bundle:nil];
[self presentModalViewController:second animated:YES];

これは、MainVC にアクセスするために使用したコードです。

[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];

そして、これが起こったことです:

ここに画像の説明を入力

ページはカールしませんでした。これに遭遇する理由は何ですか?

4

6 に答える 6

3

次の呼び出しで、2 つのビューを順番に表示する必要があります。

[self presentViewController:firstViewController animated:YES completion:^(
    [self presentViewController:secondViewController animated:YES completion:^(

    }];
}];

これはより良い動作をするはずです。また、後で両方の viewController をプルする必要があることにも注意してください。

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{
    [self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{

    }];
}];
于 2013-08-29T03:28:56.147 に答える
0

を使用する必要がありますunwind segue。セグエ先のView Controllerに「空の」IBActionを作成します。

@IBAction func unwindToController(segue: UIStoryboardSegue) {

}

次に、ストーリーボードに移動して、元にしたいコントローラーを選択します。選択したコントローラーの上部にあるアイコンの左端は、中央に小さな白い四角形がある黄色の円で、別名ファイル所有者です。アンワインド先のView Controllerの「Exit」ラベルにCtrlキーを押しながらドラッグします。出口は、コントローラー ツリーの下部近く、またはストーリーボード上で右矢印付きの白い四角が入った一番右の赤い四角の画像として見つけることができます。ダイアログが表示されるので、unwindToController作成したアクションを選択します。

新しい「Unwind segue to Exit」が FROM コントローラーに表示されます。それをダブルクリックして、識別子を付けます。unwindIdentifier

2 つのコントローラーをアンワインドする場合は、FROM コントローラーで次を使用します。

self.performSegueWithIdentifier("unwindIdentifier", sender:nil)

これにより、中央のコントローラーがスキップされて 2 番目のコントローラーに巻き戻され、TO コントローラーのみがアニメーションに表示されます。

于 2016-05-09T16:52:16.393 に答える