我有一个崩溃报告,这是一个真正的边缘案例。我从 applicationWillEnterForeground
启动 pin 安全 View (该功能是可选的)。但是,我有一些表单,我在我的应用程序中的某些情况下使用它们。
因此,引脚 View 被添加为窗口上的 subview ,并显示了一个键盘。
当表单显示时,它出现在 pin View 的顶部(这是错误的),并且当显示另一个键盘时,表单上的操作会导致崩溃。
所以我相信如果应用程序退出/激活,我需要关闭任何表单。
我已考虑向 applicationWillEnterForeground
中的表单发送通知,但是我必须首先确定表单是否可见,然后添加方法以将其关闭每个表单。
对于边缘情况,这似乎需要做很多工作,有人可以提出替代方法吗?
为了完整起见,这是错误...
The layout constraints still need update after sending -updateConstraints to <_UIKeyboardLayoutAlignmentView: 0x14e59b790; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = >. _UIKeyboardLayoutAlignmentView or one of its superclasses may have overridden -updateConstraints without calling super. Or, something may have dirtied layout constraints in the middle of updating them. Both are programming errors.
我见过这个...
NSInteralInconsistencyException - UIKeyboardLayoutAlignmentView
但是,我仍然需要在各种表单中结束编辑,我无法从
applicationWillEnterForeground
访问这些表单。 .
最佳答案
好的,研究了这个问题后我发现我需要观察应用程序的状态。在通知上然后检查是否加载了各种对象,如果是,则在显示键盘(也就是正在编辑)时 resignFirstResponder(我在 UIAlertView 中有一个文本字段),关闭 UIAlertView,然后在对话框中使用的 View Controller 中关闭。
嘘……没有我希望的那么简单。
虽然这对我来说是一个边缘案例,但我认为我应该修复它。
我还发现了这个将关闭警报 View https://github.com/sdarlington/WSLViewAutoDismiss
这将在更简单的场景中为我省去很多麻烦。
显然,从 iOS4 开始,Apple 建议在应用程序处于事件状态时取消 UIAlertViews 和 UIActionSheets。
关于ios - 键盘显示在不同 View 上,导致 UIKeyboardLayoutAlignmentView 约束错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31302238/