ios - 通过在 lldb 中添加 borderColor 来调试 View

标签 ios objective-c xcode debugging lldb

我正在尝试使用 lldb 在调试期间为特定 View 添加边框,以便在运行时对其进行修改。

例如,我在我的代码某处放置了一个断点并在 lldb 中执行:

(lldb) p [[self.scrollview layer] setBorderWidth:1]

这很好用,但现在我想更改边框颜色,但出现错误 :( 。 这是我尝试过的:

(lldb) p [[self.scrollview layer] setBorderColor:[[UIColor redColor] CGColor]]
error: no known method '-CGColor'; cast the message send to the method's return type


(lldb) po [[self.scrollview layer] setBorderColor:(CGColor*)[[UIColor redColor] CGColor]]
error: use of undeclared identifier 'CGColor'


(lldb) p [[self.scrollview layer] setBorderColor:(id)[[UIColor redColor] CGColor]]
error: cannot initialize a parameter of type 'CGColorRef' (aka 'CGColor *') with an rvalue of type 'id'


(lldb) p [[self.scrollview layer] setBorderColor:(void*)[[UIColor redColor] CGColor]]
error: cannot initialize a parameter of type 'CGColorRef' (aka 'CGColor *') with an rvalue of type 'void *'

最佳答案

(已编辑,因为我的答案不正确。)

看来你需要把它扔到 hell 然后再回来:

[[self.scrollview层] setBorderColor:(CGColorRef)[(id)[UIColor redColor] CGColor]]

关于ios - 通过在 lldb 中添加 borderColor 来调试 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25765474/

相关文章:

ios - 使用 ALAssetLibrary 从图库加载视频时未获得 Assets 值(value)

ios - RefreshControl 仅出现在水平 ScrollView (iOS)中的第一个子项之上

ios - 从 UIViewController 显示 UIView 作为上下文菜单预览

iphone - UITableView 在点击时并不总是触发委托(delegate)方法

ios - Xcode 10 应用程序安装失败,发生未知错误

iOS:类的实例返回一个 View ,这个 View 有不起作用的按钮

iphone - 从 Springboard 返回后导致普遍跳过的 AudioUnits

iphone - 更改重复使用的单元格的类型?

xcode - 如何为 arm64e 编译 FFmpeg - clang 无法创建可执行文件

ios - 枚举 NSString 的最佳方法