0

現在、ユーザーの iPod ライブラリ (「B」) をモーダルに表示する ViewController (「A」) があります。

// This works great
- (void)selectSong { // UIBarButtonSystemItemAdd target action
    MPMediaPickerController *picker = [[MPMediaPickerController alloc] init];
    picker.delegate = self;
    [self presentViewController:picker animated:YES completion:NULL];
}

委譲を介して "A" 内からモーダルに提示された VC "B" を却下します。

- (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
    // Do stuff with selected item...

    // Set up modal transition style and then dismiss
    [mediaPicker setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [mediaPicker dismissViewControllerAnimated:YES completion:^{
        // Launch capture screen
        // DOING IT THIS WAY CLEARLY SHOWS VIEW "A" BEFORE WE SEE VIEW "C"
        // I'M LOOKING FOR A WAY I CAN DISMISS THE MODAL IPOD MUSIC PICKER
        // VIA "FLIP" DIRECTLY TO VIEW CONTROLLER "C" (WHICH DOES SOMETHING
        // WITH THE SELECTED SONG).
        [self performSegueWithIdentifier:@"captureViewController" sender:self];
    }];
}

この実装では、技術的にすべてが機能します。私が気に入らないのは、ViewController A が B と C の両方を提示する方法で、ユーザーは ViewController A が B を却下した後、C を提示する前に見ることができるということです。 C. どうすればこれを達成できますか?

*更新: また、手動のセグエ呼び出しを完了ブロックの外に置くと、一度に 2 つのものを提示することに関するエラーが発生することにも注意してください。アニメートを NO に切り替えると、別のエラーが発生します。

4

2 に答える 2

0

これで試して、

- (void)selectSong { // UIBarButtonSystemItemAdd target action
    MPMediaPickerController *picker = [[MPMediaPickerController alloc] init];
    picker.delegate = self;
 [self performSegueWithIdentifier:@"captureViewController" sender:self];
    }];
    [self presentViewController:picker animated:YES completion:NULL];
}
于 2013-06-18T05:48:53.507 に答える
0

ストーリーcaptureViewControllerボードに識別子を付けます。

- (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
    // Do stuff with selected item...

    // Set up modal transition style and then dismiss

    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"STORYBOARDNAME" bundle:nil];
    UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"captureViewController"];
    [self presentModalViewController:vc animated:NO];

    [mediaPicker setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [mediaPicker dismissViewControllerAnimated:YES completion:nil];
}
于 2013-06-18T05:45:27.850 に答える