IOS界面调试神器DCIntrospect

对于使用代码来写UI的同志,使用DCIntrospect来查看元素信息调整布局,再也不用凭眼睛来估了,先来看看截图

DCIntrospect是github上的开源项目:下载源码

大概介绍下用法:

  1. DCIntrospect拖到项目中,添加 QuartzCore framework

  2. 在方法didFinishLaunchingWithOptions中添加下面的代码:

// always call after makeKeyAndDisplay.

#if TARGET_IPHONE_SIMULATOR

[[DCIntrospect sharedIntrospector] start];

#endif

只支持在模拟器上跑,好像也支持真机,可以试试

3.编译运行项目,在模拟器上跑起来项目后,选中模拟器,按键盘空格键,这时你会在模拟器顶部Bar上显示成下面这样

键盘上的快捷键:


  • Start/Stop: 空格键

  • Help: ?

  • Print properties and actions of selected view to console: p

  • Print accessibility properties and actions of selected view to console: a

  • Toggle all view outlines: o

  • Toggle highlighting non-opaque views: O

  • Nudge view left, right, up & down: 4 6 8 2 (use the numeric pad) or ← → ↑ ↓

  • Print out the selected views’ new frame to console after nudge/resize: 0

  • Print selected views recursive description to console: v

注意:

需要在DEBUG环境才有效.

类似的工具还有:Spark InspectorRevealapp。这两个功能更全了,有兴趣的可以试试,Spark Inspector要收费的,而且还不菲,Revealapp目前免费期。

posted @ 2013-06-22 08:41  yingkong1987  阅读(1063)  评论(1编辑  收藏  举报