SKAction规模不适用于iPhone 5S(SKAction scaleTo not working on iPhone 5S)
我使用iPhone 5S作为开发目标(模拟器和真实设备)时发现了一种奇怪的行为。
我想用
SKAction.scaleTo
。 这适用于iPhone 4S和iPhone 5模拟器(使用iOS 7.0.3和iOS 8测试)。但在iPhone 5S模拟器上,节点无法扩展。 在我真正的iPhone 5S上也没有扩展。
这是我的代码:
for tile in tileArray{ if(tile.color == searchColor){ var action = SKAction.scaleTo(0.5, duration: 0.5) var action2 = SKAction.scaleTo(1, duration: 0.5) tile.runAction(SKAction.repeatActionForever(SKAction.sequence([action, action2]))) } }
编辑:
我现在发现,在iPhone 5S上没有调用if-block。 我不知道为什么。 对于其他iPhone,它的工作原理。但是如你所见,两种颜色是相同的:
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1 UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
怎么可能?
重要说明:其他SKaction.scaleTo操作正常运行没有任何问题。
I've found a strange behavior while using the iPhone 5S as development-target(Simulator and real device).
I'd like to scale a
SKSpriteNode
with anSKAction.scaleTo
. This works fine on the iPhone 4S and the iPhone 5 simulator(Tested with iOS 7.0.3 and iOS 8).But on the iPhone 5S simulator, the node doesn't scale. Also on my real iPhone 5S it doesn't scale.
Here is my code:
for tile in tileArray{ if(tile.color == searchColor){ var action = SKAction.scaleTo(0.5, duration: 0.5) var action2 = SKAction.scaleTo(1, duration: 0.5) tile.runAction(SKAction.repeatActionForever(SKAction.sequence([action, action2]))) } }
EDIT:
I've now found out, that the if-block doesn't get called on the iPhone 5S. I don't know why. For the other iPhones it works.But as you see, the two colors are the same:
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1 UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
How is that possible?
Important: Other SKaction.scaleTo actions are working without any problems.
原文:https://stackoverflow.com/questions/25837970
最满意答案
HashSet<T>
是您要查找的内容。 从MSDN (重点加入):
HashSet<T>
类提供了高性能的集合操作。 集合是不包含重复元素的集合,其元素没有特定的顺序。请注意,如果将项目添加到集合中,则
HashSet<T>.Add(T item)
方法返回一个bool
-true
; 如果该项目已经存在,则为false
。
HashSet<T>
is what you're looking for. From MSDN (emphasis added):The
HashSet<T>
class provides high-performance set operations. A set is a collection that contains no duplicate elements, and whose elements are in no particular order.Note that the
HashSet<T>.Add(T item)
method returns abool
--true
if the item was added to the collection;false
if the item was already present.
相关问答
更多-
Multisets在python 2.7或更高版本中被实现为(可变的) Counter对象。 你可以对集合执行许多相同的操作,例如联合,交集,差异(尽管计数可以变为负数)等等。 from collections import Counter as mset 解: (mset("aabbcc") & mset("aabd")).elements() 更多细节: >>> intersection = mset("aabbcc") & mset("aabd") Counter({'a': 2, 'b': 1} ...
-
通常,您使用的方法是一个好主意。 但是我可以提出一个解决方案,使算法更快。 function unique(arr) { var u = {}, a = []; for(var i = 0, l = arr.length; i < l; ++i){ if(!u.hasOwnProperty(arr[i])) { a.push(arr[i]); u[arr[i]] = 1; } } return a ...
-
执行此操作的最有效的订单保留方式是使用Set作为辅助数据结构: def unique[A](ls: List[A]) = { def loop(set: Set[A], ls: List[A]): List[A] = ls match { case hd :: tail if set contains hd => loop(set, tail) case hd :: tail => hd :: loop(set + hd, tail) case Nil => Nil } ...
-
HashSet
是您要查找的内容。 从MSDN (重点加入): HashSet 类提供了高性能的集合操作。 集合是不包含重复元素的集合,其元素没有特定的顺序。 请注意,如果将项目添加到集合中,则HashSet .Add(T item)方法返回一个bool - true ; 如果该项目已经存在,则为false 。 HashSet is what you're looking for. From MSDN (emphasis added): The HashSet class provi ... -
有没有一种从DropDownList获取唯一项目的简单方法?(Is there a simple way to get unique items from DropDownList?)[2023-03-18]
总是迭代: Dim uniqueItems As New ListItemCollection() For Each myItem As ListItem In listitems If Not unique.Contains(myItem) Then unique.Add(myItem) End If Next 就运行时或代码而言,这可能不是最简单的答案,但它是最简单的概念(至少对我来说)。 编辑:mat1t解决方案的代码 Dim uniqueValues As IEnu ... -
在列表中查找唯一项目(Finding Unique Items in a List)[2022-09-20]
这是一个使用nth0/4的简单解决方案(或者如@false指出的那样select/3 ): unique(X, L) :- nth0(_, L, X, R), \+ member(X, R). nth0/4第四个参数R是删除元素X的列表L 我们简单地检查一下, X不在R 。 更好的版本 unique(X, L) :- nth0(_, L, X, R), maplist(dif(X), R). 这解决了@false指出的问题,但由于您是初学者,我怀疑这对您有多大兴趣。 这有 ... -
这应该工作: sorted(set(itertools.chain.from_iterable(sequences))) This should work: sorted(set(itertools.chain.from_iterable(sequences)))
-
Python列表中的唯一项(Unique items in python list)[2023-08-13]
你可以为此使用集合。 date = "2010-11-22" timestamps = set(['2011-02-22', '2011-02-05', '2011-02-04', '2010-12-14', '2010-12-13', '2010-12-12', '2010-12-11', '2010-12-07', '2010-12-02', '2010-11-30', '2010-11-26', '2010-11-23', '2010-11-22', '2010-11-16']) #then you ... -
可能有很多方法可以解决这个问题。 我只想提两种可能性。 将维度与基于数组的键一起使用。 dc.js的社区分支支持“标记”维度 ,其中行可以与多个键值相关联。 如果我理解正确,如果您使用此功能,则无需展平数据。 使用组而不是数据表的维度。 只要你可以降序排列,这就可以了, 如本例所示 。 这样您就可以显示聚合数据而不是原始行。 如果您需要升序,可以使用此适配器包装您的组,该适配器添加.bottom(N)方法: function reversible_group(group) { return { ...
-
ListBox中是否有选定项目的ASP.NET集合?(Is there an ASP.NET collection for selected items in ListBox?)[2023-09-01]
这样的东西应该让你选择的项目: ListselectedItems = new List (); int[] selectedItemsIndexes = myListbox.GetSelectedIndices(); foreach (int selectedItem in selectedItemsIndexes) { selectedItems.Add(myListbox.Items[selectedItem]); ...