gpt4 book ai didi

iphone - ECSlidingViewController 缩放动画

转载 作者:行者123 更新时间:2023-12-03 21:15:08 24 4
gpt4 key购买 nike

我正在尝试使用 ECSLidingViewController2 中的缩放动画设置滑动过渡。

就像在 TransitionFun 示例 ( https://github.com/ECSlidingViewController/ECSlidingViewController/blob/master/Examples/TransitionFun/TransitionFun/METransitionsViewController.m ) 中一样,我在我的 topView NavigationController 的 viewDidLoad 中执行此操作:

id<ECSlidingViewControllerDelegate> transition = [[MEZoomAnimationController alloc] init];
self.slidingViewController.delegate = transition;

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

我在 NavigationController 头文件中采用 ECSlidingViewControllerDelegate 协议(protocol)。

但它在 ECSlidingViewController.m 中崩溃,在该方法的第一个 if 条件下,我收到 EXC_BAD_ACCESS(1) 错误:

- (CGRect)frameFromDelegateForViewController:(UIViewController *)viewController
topViewPosition:(ECSlidingViewControllerTopViewPosition)topViewPosition {
CGRect frame = CGRectInfinite;

if ([(NSObject *)self.delegate respondsToSelector:@selector(slidingViewController:layoutControllerForTopViewPosition:)]) {
id<ECSlidingViewControllerLayout> layoutController = [self.delegate slidingViewController:self
layoutControllerForTopViewPosition:topViewPosition];

if (layoutController) {
frame = [layoutController slidingViewController:self
frameForViewController:viewController
topViewPosition:topViewPosition];
}
}

return frame;

}

有人遇到同样的问题吗?谢谢

最佳答案

这就是我在 View Controller 的 viewDidLoad: 方法中所做的,它效果很好:

id<ECSlidingViewControllerDelegate> transition = self.zoomAnimationController;
self.slidingViewController.delegate = transition;
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning;
self.slidingViewController.customAnchoredGestures = @[];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];

如果像我一样,您不尝试实现动态转换,则应该删除这样的行:

[self.navigationController.viewremoveGestureRecognizer:self.dynamicTransitionPanGesture];

恕我直言,这可能是导致 EXC_BAD_ACCESS(1) 错误的原因,因为您尚未实际设置dynamicTransitionPanGesture手势识别器。

关于iphone - ECSlidingViewController 缩放动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21798025/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com