I have created a button which I want to expand/contract. I found a way to get the x,y coordinates along with width and height. Using these I call CGRectMake function to redraw the button. I am trying to figure out how to redraw in an animated fashion. Below is my attempt but I am almost sure that there are better ways of doing this. Any comments?
pointX = navigateBtn.frame.origin.x;
pointY = navigateBtn.frame.origin.y;
height = CGRectGetHeight(navigateBtn.frame);
width = CGRectGetWidth(navigateBtn.frame);
for (int i=1;i<=800000;i++) {
int k=i/100000;
navigateBtn.frame=CGRectMake(pointX, pointY, width, height*k);
}
Thanks in advance.
All you need to know is what the destination
rectwill be and then you can animate like this