如果轻轻触摸,强制触摸动画会冻结 [英] Force Touch animation freezes if gently touched

查看:104
本文介绍了如果轻轻触摸,强制触摸动画会冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在聊天视图中的应用中实施了Force Touch。当用户强制触摸另一用户的聊天消息泡泡时,呈现他/她的简档。出于某种奇怪的原因,当轻轻按下消息气泡时,交互式转换会卡住,所有可见的是应该逐步淘汰的视图的屏幕截图。

I have implemented Force Touch in my app in the chat view. When a user force-touches the chat message bubble of the other user, his/her profile is presented. For some strange reason, when the message bubble is gently pressed, the interactive transition gets stuck and all that is visible is a screenshot of the view that is supposed to be phased out.

我使用View Hierarchy Debugger调试了这个问题, UITransitionView 绝对是最顶级的视图。该应用程序不会崩溃 - 它仍在运行,用户仍然可以接收消息,但不能查看它们,退出屏幕等等,因为屏幕截图卡在了顶部。

I've debugged this issue as well using the View Hierarchy Debugger and the UITransitionView is definitely the top-most view. The app does not crash - it is still running and the user can still receive messages but not view them, exit out of the screen, etc. because of the screenshot stuck on top.

有没有人遇到过这样的问题?听起来像一个苹果虫。

Has anyone ever had any issues like this? Sounds like an Apple bug.

推荐答案

我找到了这个错误的原因。

I found a reason for this bug.

如果你的视图控制器需要支持强制触摸预览,你需要通过调用

If your view controller need to support preview for force touch, you need register this view controller with delegate by calling

- (id <UIViewControllerPreviewing>)registerForPreviewingWithDelegate:(id<UIViewControllerPreviewingDelegate>)delegate 
    sourceView:(UIView *)sourceView NS_AVAILABLE_IOS(9_0);

执行此操作的方法。

I只是突然调用此函数两次(一次在超类' viewDidLoad()中,一次在子视图控制器中),当我在子视图中删除一次控制器,这个错误是修复的!令人惊讶......

I just suddenly call this function twice (once in super class' viewDidLoad(), once in subview controller's), and when I remove once in my subview controller, this bug is fixed! Amazing...

它仍然是一个苹果虫,因为它没有发生这种情况。但是,希望这个答案可以帮助那些与我有同样问题的开发人员。

It's still an Apple bug since it makes no sence for that happens. However, wish this answer can help developers who has the same issue with me.

仅供参考。我只是浏览你的Github代码,没有发现注册方法的双重调用。也许还有其他原因导致这个错误。您可以尝试删除 UITableViewController 的子类中的register方法。顺便说一下,当视图控制器使用ComponentKit时,我重现了这个问题。

FYI. I just browse your Github code, found no double calls for register method. Maybe there's other reason for this bug. You could try to remove register method in your UITableViewController's subclass. By the way, I reproduce this issue when a view controller use ComponentKit.

这篇关于如果轻轻触摸,强制触摸动画会冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆