如何赚取保证金
在我的应用程序中,我想在红色矩形内移动对象(使用下面的代码从触摸)如何制作此
代码 :
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
code :
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:[touch view]];
if (insidethepaddle) {
object1.center = CGPointMake(location.x, location.y - 50);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使用
CGRectContainsPoint(CGRect rect, CGPoint point)
或NSPointInRect(NSPoint aPoint, NSRect aRect)
测试中心是否仍在内部,否则不更新对象中心
。指定的
CGRect
/NSRect
表示红色矩形的边框。Just use
CGRectContainsPoint(CGRect rect, CGPoint point)
orNSPointInRect(NSPoint aPoint, NSRect aRect)
to test if the center is still inside, otherwise just don't update the objectscenter
.The specified
CGRect
/NSRect
represents the frame of the red rectangle.