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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top