【问题标题】:CGPoint giving the same value for x and y?CGPoint 为 x 和 y 提供相同的值?
【发布时间】:2012-02-21 15:22:27
【问题描述】:

这是我在旧 iPod 上测试时遇到的一个奇怪错误。我试图在 touchesMoved 上获取位置值,但 y 总是输出等于 x 的值。如果我使用 NSStringFromCGPoint 登录,那么我会得到正确的输出。为什么单独访问 x 和 y 不起作用?

CGPoint location = [singleTouch locationInView:self.view];
NSLog(@"Location using NSStringFromCGPoint %@", NSStringFromCGPoint(location)); // output: {27, 136}
NSLog(@"Location using x and y %f %f",location.x, location.y); // output: 27, 27

【问题讨论】:

    标签: cgpoint


    【解决方案1】:

    看来问题与 CGPoint 无关,而是与 plist 参数有关。

    question 解决了我的问题。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-06
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 2011-09-03
    相关资源
    最近更新 更多