如何赚取保证金

发布于 2024-10-25 03:28:57 字数 341 浏览 7 评论 0原文

在我的应用程序中,我想在红色矩形内移动对象(使用下面的代码从触摸)如何制作此 iphone screen

代码 :

UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:[touch view]];
if (insidethepaddle) {
    object1.center = CGPointMake(location.x, location.y - 50);
}

in my app i want to move objects (from touch using the code below) inside the red rectangle how to make this iphone screen

code :

UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:[touch view]];
if (insidethepaddle) {
    object1.center = CGPointMake(location.x, location.y - 50);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏佲洛 2024-11-01 03:28:57

只需使用 CGRectContainsPoint(CGRect rect, CGPoint point)NSPointInRect(NSPoint aPoint, NSRect aRect) 测试中心是否仍在内部,否则不更新对象中心

指定的CGRect/NSRect表示红色矩形的边框。

Just use CGRectContainsPoint(CGRect rect, CGPoint point) or NSPointInRect(NSPoint aPoint, NSRect aRect) to test if the center is still inside, otherwise just don't update the objects center.

The specified CGRect/NSRect represents the frame of the red rectangle.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文