0
votes

I am banging my head on the wall here due to this problem:

When I create a UIImageView this view has a certain orientation and size. Lets call this state "A".

This view responds to taps. It can be dragged around the screen.

At some point in the code I apply a CGAffineTransform to the view. Does not matter if the affine is a scale, a rotation, a translation or a combination of all. Does not matter also if the transform is absolute or relative. Not to mention the device can change its orientation and the view is autorotated to the correct orientation (that we can cay is a kind of rotation or transformation applied to the view).

The problem is: the moment I touch that object or try to animate its transparency or any other parameter, it "remembers" the state "A" and does all animations from that state, not from current state. If I simply touch the view, it returns instantly to state "A". The code is not doing it by itself. It is pretty annoying. How to I make a view assume its current state of transformations as the reset or initial state? In other words, how do I make a view forget its past transformations or states?

The only way I know is recreating the view, but this is a ridiculous way of doing this.

Is there any way to make this work as I described?

thanks

1
"I apply a CGAffineTransform to the view" <- please show what this means in code.Ken
please show the code....Madhup Singh Yadav
Without more information, I would suspect that you are manipulating a COPY of the view, or applying the transform to a COPY (or new Object). Check the memory address of the pointer reference to your "A" object and compare it to the object that is transformed, and to the one that is dragged. They should all be the same.gnasher

1 Answers

2
votes

Afaik, all of the SDK animations automatically create a copy, perform the animation on the copy while hiding the original. In your code you'll have a getState line that starts this and creates the pointer to the animation object. To make it permanent at the end of your animation routine set the original objects view to the animation view.

Iirc it something like this, but I don't have my code samples in front of me:

myOriginalObject.view = myMnimationObject.view

Obviously do this before you release your animations but after you're done with the transforms.