存储mousedown位置 [英] Store mousedown locations

查看:122
本文介绍了存储mousedown位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的可可应用程式会计算每个mousedown活动的位置。下次单击鼠标时,该位置将被新的位置覆盖。如何存储位置?

My cocoa app calculates the location for every mousedown event. The next time the mouse is clicked, the location is overwritten by the new one. How can I store the locations? Is it possible to create an array with mousedown locations?

感谢

推荐答案

p>当然可以。因为你处理一个原始结构(NSPoint),你需要将它包装在一个对象中,然后你可以把它放在NSArray中。 NSValue是一个现成的类,允许你这样做,看看 [NSValue valueWithPoint:aPoint];

Sure you can. Since you're dealing with a primitive struct (NSPoint) you'll need to wrap that in an object before you can put it in an NSArray though. NSValue is a ready-made class that allows you to do this, take a look at [NSValue valueWithPoint:aPoint];.

这篇关于存储mousedown位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆