测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | 2014年12月 |
由 Mikkel Selsoe Sorensen、Lukas Welte 维护。
推特: @lukaswelte
网站: http://lukaswelte.de
DCIntrospect 由 domesticcat 初始建立,是一系列用于 iOS 的调试工具,有助于使用 UIKit 构建用户界面的调试。它特别适用于动态创建或随运行时可以改变的用户界面布局,或者通过查找非不透明视图或不需要重绘的视图来调整性能。它设计用于在 iPhone 模拟器中使用,但也可在设备上使用。
它使用键盘快捷键来处理启动、结束和其他命令。如果您打算在设备上使用,还可以通过全局 UIGestureRecognizer
调用它。
recursiveDescription
)在开始之前,请确保已经设置了 DEBUG
环境变量。DCIntrospect 除非这个变量被设置,否则将不会运行,以避免在生产使用中被遗留在那里。
将 DCIntrospect
类文件添加到您的项目中,如果需要的话,添加 QuartzCore 框架。要启动
[window makeKeyAndDisplay]
// always call after makeKeyAndDisplay.
#if TARGET_IPHONE_SIMULATOR
[[DCIntrospect sharedIntrospector] start];
#endif
针对模拟器的 #if
目标不是必需的,但将其设置为在产品代码中进一步防止它被留下是一个好主意。
一旦设置好,只需按下空格键来调用 introspect,然后开始点击视图以获取信息。您还可以在界面周围进行点击和拖动。
包含一个小示例应用以进行测试。
空格键
?
p
a
o
O
4 6 8 2
(使用数字键盘)或 ← → ↑ ↓
0
v
按下 p
将记录有关所选视图的可用属性。DCIntrospect 将尝试对它们能理解的值进行整理并以更有用的信息显示。以下是一个从 UIButton
的示例
** UIRoundedRectButton : UIButton : UIControl : UIView : UIResponder : NSObject **
** UIView properties **
tag: 1
frame: {{21, 331}, {278, 37}} | bounds: {{0, 0}, {278, 37}} | center: {160, 349.5}
transform: [1, 0, 0, 1, 0, 0]
autoresizingMask: UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin
autoresizesSubviews: YES
contentMode: UIViewContentModeScaleToFill | contentStretch: {{0, 0}, {1, 1}} backgroundColor: nil
alpha: 1.00 | opaque: NO | hidden: NO | clips to bounds: NO |
clearsContextBeforeDrawing: YES
userInteractionEnabled: YES | multipleTouchEnabled: NO
gestureRecognizers: nil
** UIRoundedRectButton properties **
** Targets & Actions **
target: <DCIntrospectDemoViewController: 0x4c8c0e0> action: buttonTapped:
编辑文件 DCIntrospectSettings.h
以更改键盘快捷键。如果你使用笔记本电脑/无线键盘进行开发,可能需要更改键盘快捷键。
在 MIT 许可下提供。
如果您有任何功能请求/错误修复等,请随时提供建议并发送拉取请求,或创建一个新的问题。