ios - Animating a UIView -


i have animated rectangle grows in length:

[uiview animatewithduration:60                  animations:^{                  cgrect frame = left.frame;                  // adjust size of frame desired value                  frame.size.height -= 0.1;                  left.frame = frame; // set frame on view adjusted size                  }                  completion:^(bool finished){                  // re-start animation if desired                  }]; 

however, rectangle change it's height goes downwards, rather upwards. how can change make rectangle grow upwards?

you changing height of frame. keep same x , y origin values.

you need change height , origin, htis...

[uiview animatewithduration:60                  animations:^{                      cgrect frame = left.frame;                      // adjust size of frame desired value                      frame.size.height -= 0.1;                      frame.origin.y += 0.1; // make opposite origin height                      left.frame = frame; // set frame on view adjusted size                  }                  completion:^(bool finished){                      // re-start animation if desired                  }]; 

to loop 0 height 100 height (for example)

- (void)animateheight {     [uiview animatewithduration:60                           delay:0.0                         options:uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat                      animations:^{                          cgrect frame = left.frame;                          // adjust size of frame desired value                          frame.size.height = 100;                          frame.origin.y -= 100; // make opposite origin height                          left.frame = frame; // set frame on view adjusted size                      }                      completion:^(bool finished){                          // animation auto reversing , repeating.                      }]; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -