问题标签 [cgpoint]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
objective-c - 如何在目标 c 中存储手指运动的路径?
我想在 iPhone 屏幕上存储手指移动的路径。到目前为止,我只是在阅读触摸并将 CGPoints 添加到 NSMutableArray。当我尝试打印该数组中的所有 cgpoint 时,它是如何丢失中间点的。有更好的方法吗?我们可以直接存储整个路径吗?
这是我正在使用的代码
ios - CGImageRef 内的 CGPoint
我可以知道 aCGPoint
是否在 a 内CGImageRef
吗?或者我应该转换成CGImageRef
其他格式?
更新
哪里currentM
是一个unsigned char
,maskcontext
是一个CGContextRef
,maskImage
是一个CGImageRef
,我想知道它的rect
。
ios - CGPoint 的奇怪行为
我在班级的接口部分有 CGPoint
在代码中,我尝试为其设置值
但结果是 (0,1)
另一个例子:
结果:qwe(10,20),点(0,10)
在接口(CGFloat,NSNumber..)中声明的所有变量都存在同样的问题
怎么回事?
iphone - 在iphone上画一个不规则的多边形
我有这个问题:我有一个点数组,我会用 Quartz 或类似的点绘制一个不规则多边形。你能建议我做这个的最好方法吗?
MyTest drawRect 是这样的:
objective-c - 比较 CGPoint 和图像中心属性
我真的可以在这里得到一些帮助。在过去的几个小时里,我试图弄清楚如何比较 CGPoint 的值和图像的 center 属性。我假设这两个值是 x 和 y 坐标的形式。下面是我写的代码。
当比较 jigsawCompleted 方法中的两个值时,我得到错误:二进制表达式的操作数无效('CGpoint'(又名'struct CGPoint')和'CGPoint')。
请问有什么帮助吗?
ios - Placing a UIImageView on screen, issue with conversion of UIView coordinates
I have problems getting the coordinate convertion from the local view frame to the window right. I have an "Arrow" image that needs to be moved relative to a UIButton on the page when tapped and when the page loads.
The Arrow image (intense name "interfaceApertureSelectionArrow") is initialized in the "didLoadView" method
For reacting on the button tap I implemented a Button Action, doing the coordinate conversion using the "convertPoint" method. In this case the conversion and arrow placement works works just right (!)
... so far so good. Now here's the problem. When I try to position the arrow next to the "darkButton" coordinates in the viewDidLoad method to show the selection not only on tapping the button but also on loading the view initially the positioning does not work! Here's what I tried.
Added to the viewDidLoad method:
The move function that animates the movement of the arrow's UIImageView (in case this is relevant as well)
Checking the CGPoint value before and after the conversion of the darkButton's CGPoint coordinates shows me that is does not change. How come? (as it did work in the "setAttributeAperture" button method)
cgaffinetransform - 仿射翻译可防止 CGPoint 重定位
我展开并移动了一个标签(instructionLabel),然后将其恢复为原始大小,但将其保留在新位置。
后来,我明确地使用 CGPointMake 将标签放回原来的位置,但它仍然在翻译位置(从原来的位置高出 70 点)。
我已经通过 Breaks 和 NSLog 验证了 CGPointMake 和 CGRectMake 语句已达到......在仿射变换之后它们只是不起作用。有谁知道为什么?(我不想在翻译例程之后立即将标签移回,但如果我无法弄清楚为什么 CGPointMake 例程不这样做,我可能不得不这样做。)
感谢您的任何建议。-抢
objective-c - 无法声明/初始化 CGPoints 数组
就像我最近的大多数问题一样,我认为这是一个语法问题。我知道我想做什么,但我不知道怎么写。我正在尝试创建一个拼图类型的应用程序。CGPoints 代表每个图像应该在哪里的中心点。
- 我创建了 40 个图像并将它们放入一个数组中。
- 我想创建 40 个 CGPoints 并将所有这些点放在一个数组中。
- images[0] 处的图像在 cgpoints[0] 处具有相应的中心 - 或者更确切地说,这是图像应该放置在拼图中的位置。
我在声明/初始化 CGPoints 数组时遇到了麻烦。下面是代码:
.h 文件
.m 文件
我不知道这是否有点混乱。正如你所看到的,我开始时只有 8 个“支架”,这些 CGPoints 代表应该放置拼图的中心。
ios - 将新的 CGPoint 值与 Array 中的 CGPoint 值进行比较
我正在生成许多具有随机位置的圆圈。我要防止的是圆圈相互重叠。所以我想将新生成的 CGPoint 值与数组中的值进行比较,如果该值位于其中一个 CGPoint 的半径区域中,则让它生成一个新值。
除了重叠的东西,我得到了大部分。我已经从我尝试过的东西中评论了这部分,但这并没有真正起作用(有缺陷的逻辑)。我不确定如何遍历 CGPoint 的各个值并进行比较。
更新: 我对代码进行了一些更改,并添加了一个检查以查看 CGPoint 是否会重叠。问题是每当我想尝试类似的东西时
我不断陷入无限循环。
objective-c - 将 CGPoint 传递给另一个方法以 (inf, inf) 结尾
当试图将 CGPoint 传递给方法时,该点被传递,但是一旦在被调用的方法中,CGPoint 值就会显示(inf,inf)?因此,将位置 CGPoint 传递给 createShapeAt 方法会导致代码无法正常工作。也许我没有正确实现某些东西,或者我是否需要在传递时复制 CGPoint?