我正在开发一款应用程序,在iOS 11之后,自定义翻转卡转换无法正常工作。如果您查看下面的GIF(故意慢动画),您可以看到该卡未正确放置在返回翻转上,之后"点击"到位。对于iOS 10及更低版本,这并不会发生。它会在没有点击的情况下返回原来的位置。
我查看了新的contentInsetAdjustmentBehaviour并将其设置为.never以避免卡片和状态栏之间的空间。然而,这并没有解决问题。
if (@available(iOS 11.0, *)) {
self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
self.navigationController.navigationBar.prefersLargeTitles = NO;
self.navigationController.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
}
有没有人知道我应该在哪里解决这个问题?
更新
我查看了过渡以及确定过渡中心的位置。在这里,我为iOS 11做了一个小小的黑客攻击,为iPhone 8+及以下版本移动中心64点,为iPhone X移动了88点。但只有当我还没有开始滚动时。如果我滚动中心在所有iPhone型号上移动44点。请参阅下面的临时解决方案:
CGPoint targetCenterInContainer = CGPointMake(CGRectGetMidX(newCardFrame), CGRectGetMidY(newCardFrame));
if (@available(iOS 11.0, *)) {
double offset = newCardFrame.origin.y - originalCardFrame.origin.y;
if (offset == 64) {
targetCenterInContainer.y -= 64; // For iPhone 8 Plus and below, with no scroll offset
} else if (offset == 88) {
targetCenterInContainer.y -= 88; // For iPhone X, with no scroll offset
} else {
targetCenterInContainer.y -= 44; // For when there are scroll offset, all iPhones
}
}
这可行,但不是100%。
答案 0 :(得分:0)
我面临着来自我的应用程序的所有动画的类似问题,转换后的一些组件放错位置,所以我的建议只是禁用ios 11版本的动画我的意思是将动画值设置为false,直到apple修复所有这些问题