Xcode LLDB的常用调试技巧

393 阅读1分钟
//跳过断点所处的代码,不执行该断点代码
(lldb) thread jump --by 1

//运行时修改UI的颜色,注意这里要使用view.layer属性,直接使用view.backgroundColor会提示找不到!
(lldb) expression self.view.layer.backgroundColor = [UIColor blueColor].CGColor
(CGColorRef) $0 = 0x0000000282647300

//运行时添加代码段,动态添加一个UILabel
(lldb) expression
Enter expressions, then terminate with an empty line to evaluate:
1 UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(30,30,30,30)];
2 lab.text = @"test";
3 lab.textColor = [UIColor redColor];
4 [self.view addSubview:lab];
回车
//最后还要按一次回车,然后过掉断点即可看见效果