Transformation blocking next transformation in line

转换阻塞下转换

问题 (Question)

So I'm building a game in which the user clicks on a square, which

  • scales up to 1.2 (CGAffineTransformScale)

The square then automatically:

  • rotates 90 degrees (CGAffineTransformMakeRotation)
  • scales back down to 1.0 scale(CGAffineTransformScale)

This works for the first square, but when the user tries to click on another square, the square does not zoom in. The user must take these steps to click on the next square:

  • click on the previous square (from the paragraph above)
    • square then rotates back to its original transformation (even though it is supposed to be scaling up)

The user can then proceed to choose the next square, with the transformations working correctly.

NOTE: The squares are UIView(s) and the transformations are CGAffineTransformation(s).

Is there a way to "commit" the transformations so that the user can click the next sqaure without having to undo the previous square's transformations?

所以我建立一个游戏,用户单击一个广场,

  • 规模高达1.2(CGAffineTransformScale)

广场然后自动:

  • 旋转90度(CGAffineTransformMakeRotation)
  • 鳞片回落至1.0级(CGAffineTransformScale)

这是第一个平方,但是当用户试图点击另一个广场,广场上没有放大。用户必须采取这些步骤,点击下一个广场:

  • 点击前面的广场(从上面的段落)
    • 平方然后旋转回原来的转换(尽管它应该是扩大)

然后用户可以继续选择下一个广场,与正确的转换工作。

注意:广场是UIView(年代)和转换CGAffineTransformation(年代)。

有办法“提交”的转换,这样用户可以单击next腔调���需撤销前广场的转换?

最佳答案 (Best Answer)

To translate a view from its current position, you would pass the view's transform property as the first parameter.

This blog gives a great explanation as to how tranform works: http://iphonedevelopment.blogspot.com/2008/10/demystifying-cgaffinetransform.html

翻译一个视图从目前的位置,你将通过视图的转换属性作为第一个参数。

这个博客提供了一个伟大的解释转变是如何工作的:http://iphonedevelopment.blogspot.com/2008/10/demystifying-cgaffinetransform.html

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/16925946