1

次のコードを使用してアプリにビューを読み込んでいます。

- (void)showPicker {
ImagePickerViewController *imagePickerView = [[ImagePickerViewController alloc] initWithNibName:@"ImagePickerViewController" bundle:nil];
[self.navigationController presentModalViewController:imagePickerView animated:YES];

}

カールアップ/カールダウントランジションでロードするにはどうすればよいですか?

前もって感謝します、

ヤシン

4

3 に答える 3

7

ここに示したコードを使用して、imagePickerViewのmodalTransitionStyleプロパティを設定できます。ただし、可能な値は(SDKドキュメントから)次のとおりです。

  • UIModalTransitionStyleCoverVertical:View Controllerが表示されると、そのビューが画面の下から上にスライドします。却下されると、ビューは下にスライドします。これはデフォルトの遷移スタイルです。
  • UIModalTransitionStyleFlipHorizo​​ntal:ビューコントローラが表示されると、現在のビューが右から左への水平3Dフリップを開始し、前のビューの背面にあるかのように新しいビューが表示されます。却下すると、フリップは左から右に発生し、元のビューに戻ります。
  • UIModalTransitionStyleCrossDissolve:ビューコントローラが表示されると、現在のビューがフェードアウトし、同時に新しいビューがフェードインします。却下すると、同様のタイプのクロスフェードが元のビューに戻るために使用されます。

他のオプションでは、もっと凝ったものを手に入れる必要があります。NavigationControllerがアプリケーションのルートビューコントローラーであり、navigationControllerと呼ばれるアプリケーションデリゲートのプロパティに格納されていると仮定します。次のメソッドを実装できます。

- (void)curlInViewController:(UIViewController *)viewController {
    self.curledViewController = viewController;

    [UIView beginAnimations:@"curlInView" context:nil];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.window cache:YES];
    [self.navigationViewController.view removeFromSuperview];
    [self.window addSubview:viewController.view];
    [UIView commitAnimations];
}

- (void)curlOutViewController {
    [UIView beginAnimations:@"curlOutView" context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.window cache:YES];
    [self.curledViewController removeFromSuperview];
    [self.window addSubview:navigationController.view];
    [UIView commitAnimations];
}

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    if([animationID isEqualToString:@"curlOutView"]) {
        self.curlViewController = nil;
    }
}
于 2009-12-14T00:14:53.433 に答える
4

これは、OS3.2以降で簡単に利用できるようになりました。あなたはこのようにします:-

// if the legend button is tapped, curl up the map view to display the legend view underneath. 
- (IBAction) legendButtonPressed:(id) sender
{
    UIViewController *legend = [[LegendViewController alloc] init];
    legend.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    legend.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentModalViewController:legend animated:YES];  
    [legend release];
} 
于 2010-08-06T16:32:04.547 に答える
1

私はこれらの休眠中の質問が大好きです。ビュー遷移アニメーションを使用して新しいビューを表示し、completionHandlerでpresentModalViewControllerを使用して、新しいビューがモーダルビューとして扱われるようにすることで、多くの成功を収めました。

    UIView *container = self.view.window;
    [self.theNewViewController viewWillAppear:YES];
    [UIView transitionWithView:container
                  duration:kAnimationViewTransition 
                   options:UIViewAnimationOptionTransitionCurlUp
                animations:^{
                    [self.navigationController.view removeFromSuperview];
                    [container addSubview: self.theNewViewController.view];
                } 
                completion:^(BOOL finished) {
                    [self presentModalViewController:self.theNewViewController animated:NO];
                }
 ];
于 2012-04-24T21:56:58.970 に答える