1
有關如何按照名稱對SKShapeNode
元素的數組進行排序的任何想法?假設每個SKShapeNode.name
屬性都是一個數字100,23,31,...所有這些都是組成shapeNodesCollection
。應該做些什麼來整理成另一個陣列 - shapeNodesCollectionSorted
?下面你可以找到一些抽象的代碼。SKShapeNode元素的排序數組
class Example: GameScene {
...
var shapeNodesCollection = [SKShapeNode]()
var shapeNodesCollectionSorted = [SKShapeNode]()
...
shapeNodesCollectionSorted = ... //sorted shapeNodesCollection
}
非常感謝任何人的任何貢獻。
https://stackoverflow.com/questions/24130026/swift-how-to-sort-array-of-custom-objects-by-property-value,https://stackoverflow.com/questions/27337495/sort -a-skspritenode-array-according-to-specific-element –
@Matrin R,非常感謝 – RafalK