NSLog带有CGPoint数据 [英] NSLog with CGPoint data
本文介绍了NSLog带有CGPoint数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个CGPoint调用点被分配触摸:
I have a CGPoint called point that is being assigned a touch:
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
我想获取x坐标值到我的控制台日志:
I want to get the x coordinate value into my console log:
NSLog(@"x: %s", point.x);
当我使用这个时,日志输出为:
When I use this, log output for this is:
x:(null)
当使用调试器和变量watch调用时,我已经验证该点不为null。
I have verified that point is not null when this is called using the debugger and variable watch.
任何帮助感谢,
感谢//:)
推荐答案
实际上,记录 CGPoint
的最简单方法是:
Actually, the real easiest way to log a CGPoint
is:
NSLog(@"%@", NSStringFromCGPoint(point));
桌面Cocoa等效项是 NSStringFromPoint()
。
The desktop Cocoa equivalent is NSStringFromPoint()
.
这篇关于NSLog带有CGPoint数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文