Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我需要将路径转换为其点表示。所以我会有很多积分。我需要将所有这些整数添加到 NSArray。然后我将遍历该数组并使用这些点将我的对象放置在屏幕上。如何将这些点(可能是 X 和 Y 部分分别)添加到 NSArray?
您可以使用添加到 NSArray[NSNumber numberWithInteger:intNumber]
[NSNumber numberWithInteger:intNumber]
在数组中添加点的最佳方法是
[NSValue valueWithCGPoint:point]
其中 point 是 CGPoint 类型。 在获取时,您可以将 CGPoint 获取为
CGPoint point = [value CGPointValue]; where value is [NSValue valueWithCGPoint:point]