Xcode调试打印方法

1 NSLog

在调试的过程中,最常用的查看变量值的方法是NSLog

整数 int a = 1; NSLog("%d", a);

浮点数 float b = 1.11; NSLog("%f", b);

字符串 NSString *str = @"abc"; NSLog("%@", str);

数组 NSArray *arr = [NSArray arrayWithObjects:@"abc", @"def", @"ghi", nil]; NSLog("%@", array);

字典 NSDictionary *dict = [NSDictionary dictionaryWithObject:@"abc" forKey:@"123"]; NSLog("%@", dict);


2 print

在调试的过程中,可以在底部All Output窗口中使用print来打印整型、浮点型、布尔型的值,比如print bgImage.size.height


3 po 

在调试的过程中,可以在底部All Output窗口中使用po来打印对象的值,比如po self.view

 

 

原文地址:https://www.cnblogs.com/sunminmin/p/4516520.html