焦点引擎调试在tvOS中有隐藏的工具吗? [英] Are there any hidden tools in tvOS for Focus Engine debugging?

查看:256
本文介绍了焦点引擎调试在tvOS中有隐藏的工具吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最喜欢的iOS的隐藏调试工具之一是在 UIView 实例中使用 recursiveDescription 。这对于排除可能在屏幕外的视图位置非常有用。调查焦点引擎在电视机上带来了自己的一系列挑战,特别是在它认为是可重点的元素周围。



是否有任何隐藏的调试工具,让tvOS内省焦点引擎内部发生了什么?

解决方案

有两种有用的方法,在


One of my favorite hidden debugging tools for iOS is using recursiveDescription on UIView instances. This is very useful for troubleshooting view locations that may be off-screen, for example. Debugging the Focus Engine on tvOS brings its own set of challenges, especially around what it thinks are focusable elements.

Are there any hidden debugging tools for tvOS to introspect what is going on inside the Focus Engine?

解决方案

There are two helpful methods, both of which are actually documented in the App Programming Guide for tvOS.

UIView

If you're trying to move focus to a particular view and can't, there's a debugging method on UIView that can help explain why: _whyIsThisViewNotFocusable

The output from this method looks something like this:

(lldb) po [(UIView *)0x148db5234 _whyIsThisViewNotFocusable]
ISSUE: This view has userInteractionEnabled set to NO. Views must allow user interaction to be focusable.
ISSUE: This view returns NO from -canBecomeFocused.

UIFocusUpdateContext

The UIFocusUpdateContext object supports Xcode's QuickLook feature, so if you're paused in the debugger you can press spacebar (or click the eyeball icon next to the variable) to see a graphical representation of what the focus engine sees (image is from Apple's documentation):

这篇关于焦点引擎调试在tvOS中有隐藏的工具吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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