2

私はストーリーボードを使用していますが、基本的にこれがあります。 ここに画像の説明を入力してください

これは、UIViewControllerサブクラスをcontentViewController(Location)として持つUINavigationControllerをモーダルに表示するmapViewです。次に、そのLocationViewControllerは、テーブルの選択(EditLocation)に基づいて別のviewControllerをプッシュします。

EditLocationで、popViewControllerが呼び出されたときに情報を返したい。UINavigationControllerDelegateを使用してそれを行うことができると思いました。したがって、ロケーションでは、次のことを試みます。

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"ShowEditLocation"]) {
        UIViewController *destination = segue.destinationViewController;


        if ([destination respondsToSelector:@selector(setDelegate:)]) {
            [destination setValue:self forKey:@"delegate"];
        }
    }
}

このLocationクラスは、UINavigationControllerDelegateプロトコルに準拠しています。ただし、UINavigationControllerプロトコルからwillShowViewControllerまたはdidShowViewControllerコールバックを取得することはありません。考え?ありがとう!

4

1 に答える 1

0

セグエが発生しようとするたびに prepareForSegue メソッドが呼び出されます。

NSLog(@"desc: %@", [[self navigationController] description]);

2012-06-01 12:01:09.986 Sample_Storyboard[1126:207] desc:<UINavigationController: 0x68378e0>
于 2012-06-01T06:44:36.120 に答える