0

I have to draw a rectangular shape which appears to grow.

My Approach

1.i made a UIView subclass,say DrwArrow and in its draw rect method i am drawing my shape I am initializing it with the height required.

  1. i am now adding the DrwArrow object on my view and setting its center at the required point and then applying rotation at the required angle.

3.In order to apply scale animation i am setting its rect to 0 height and the scaling it to the required height.

Issue

The approach works fine when the rectangle is either vertical or horizontal but when the angle is not a multiple of 90 then it scales erroneously, I guess because the height of rect changes due to rotation applied..

I need suggestion regarding the approach i should follow.

Before downvoting please gv rsn so that i can improve.

amar
  • 4,285
  • 8
  • 40
  • 52
  • Not quite a duplicate, but I've just answered http://stackoverflow.com/questions/12852333/how-to-animate-the-width-and-height-of-a-uiview-in-xcode which should help - animate the scale transform, not the frame size. – jrturton Oct 12 '12 at 06:11
  • This way my rotation is getting lost... – amar Oct 12 '12 at 06:51
  • You have to apply both scale and rotation transforms - you make a transform with (e.g.) CGAffineTransformMakeScale() and you add to it by CGAffineTransformScale(), where the current transform is the first parameter. – jrturton Oct 12 '12 at 08:25

0 Answers0