小编Dan*_*Rak的帖子

如何完成交互式UIViewController转换?

我一直在尝试新的iOS 7自定义转换API,并查看了我能找到的所有教程/文档,但我似乎无法根据我的具体情况来计算这些内容.

基本上我正在尝试实现的是一个视图上的UIPanGestureRecognizer,我将向上滑动并转换到VC,其视图将从底部向上滑动,而当我将手指向上移动时当前视图将向上滑动.

没有交互转换我没有遇到任何问题,但是一旦我实现了交互(平移手势),我似乎无法完成转换.

这是来自VC的相关代码,它符合出售动画控制器所需的UIViewControllerTransitionDelegate:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"Swipe"]) {
        NSLog(@"PREPARE FOR SEGUE METHOD CALLED");

        UIViewController *toVC = segue.destinationViewController;
        [interactionController wireToViewController:toVC];
        toVC.transitioningDelegate = self;
        toVC.modalPresentationStyle = UIModalPresentationCustom;
      }
}

#pragma mark UIViewControllerTransition Delegate Methods

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:  (UIViewController *)presented                                                                   presentingController:  (UIViewController *)presenting sourceController:(UIViewController *)source {
    NSLog(@"PRESENTING ANIMATION CONTROLLER CALLED");

    SwipeDownPresentationAnimationController *transitionController = [SwipeDownPresentationAnimationController new];
    return transitionController;
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
    NSLog(@"DISMISS ANIMATION CONTROLLER CALLED");

    DismissAnimatorViewController *transitionController = [DismissAnimatorViewController new];
    return transitionController;
}

- (id …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiviewcontroller ios uipangesturerecognizer

13
推荐指数
1
解决办法
1万
查看次数