3

これが私が欲しいものです。UIViewController(UITableViewController)を提示し、presentViewControllerメソッドにdismissブロックを組み込みます。

だからこのようなもの:

[self presentViewController:vc 
    animated:YES 
    completion:nil 
    onDismiss:^{
        NSLog(@"dismissed")
    }
];

このSOソリューションを実装してみたのは、必要なものとまったく同じように見えたが、どのように実行すればよいかがよくわからなかったためです。詳細な説明を教えてくれる人はいますか?

ありがとう!

4

1 に答える 1

3

コメントでの議論を明確にするために:

ContainerViewControllerのヘッダーで、次の関数を定義します。

-(void)presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion dismissCompletion:(dispatch_block_t)dismissCompletion

ここからContainerViewControllerの関数を実装するための残りの手順に従います

次に、ViewController呼び出しで

[containerViewController presentViewController:presentedViewController animated:YES completion:<whatever> dismissCompletion:<whatever>]

ContainerViewController内からこれを呼び出す場合self、ContainerViewController(CVC)オブジェクトを使用してSomeOtherViewControllerにいる場合は、CVCオブジェクトで呼び出すことができます。

于 2013-02-20T04:01:50.173 に答える