您的位置:首页 > 其它

Xcode调试打印方法

2013-03-21 11:27 253 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: