简体   繁体   English

如何在Xcode模拟器中获取元素的尺寸

[英]How do get dimensions of elements in Xcode simulator

I'm running my react native application in the xcode simulator. 我正在xcode模拟器中运行我的React本机应用程序。 Now I would like to check for the dimensions of the elements and if possible I would like to change things temporarily to see, what I have to change in my code. 现在,我想检查元素的尺寸,如果可能的话,我想临时更改一下内容,以查看代码中必须更改的内容。 Something like the developer tools in the chrome browser. 类似于chrome浏览器中的开发人员工具。 Is this possible? 这可能吗?

在此处输入图片说明

You can use react-devtools for this (see guide in official documentation ). 您可以为此使用react-devtools (请参阅官方文档中的指南 )。

When the developer tools are installed and running, you can use the regular Element inspector debug tool from the React Native developer menu ( Cmd + D , Show Inspector ). 安装并运行开发人员工具后,您可以从React Native开发人员菜单( Cmd + DShow Inspector )中使用常规的元素检查器调试工具。

Now, instead of limited the in-simulator inspector, you have access to a Chrome Devtools like experience, where you can inspect and edit element styles and props. 现在,您不仅可以使用模拟器中的检查器,还可以使用Chrome Devtools这样的体验,您可以在其中检查和编辑元素样式和道具。

Devtools示例

使用Xcode构建应用程序并在模拟器中运行,然后可以使用调试视图层次结构工具

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM