objective c - how can i change position of object correctly? -


i use function in loop calculate new position of object:

...some code....  (int = self.frame.origin.x; <= 710; ++i) {     cgpoint newp = cgpointmake(i, 1);     float posy = * pow((newp.x - w.x),2) - w.y;      cgpoint result = cgpointmake(i, posy);     [nsthread sleepfortimeinterval:1];     self.frame = cgrectmake(result.x, result.y, self.frame.size.width, self.frame.size.height);     nslog(@"[%f, %f]", result.x, result.y); } 

, object still in place.

console print:

2012-06-04 23:13:19.183 pert estimator[326:707] [304.000000, 169.499985] 2012-06-04 23:13:20.195 pert estimator[326:707] [305.000000, 165.172806] 2012-06-04 23:13:21.197 pert estimator[326:707] [306.000000, 160.856293] 2012-06-04 23:13:22.200 pert estimator[326:707] [307.000000, 156.550461] 2012-06-04 23:13:23.225 pert estimator[326:707] [308.000000, 152.255295] 2012-06-04 23:13:24.265 pert estimator[326:707] [309.000000, 147.970810] 

etc...

what's wrong?

wow, should using animation block that.

/* starting position  */ [self setframe:cgrectmake(304, 169.499985,self.frame.size.width, self.frame.size.height)];  [uiview animatewithduration:1.0                       delay:0.0                      options:uiviewanimationcurveeaseout                   animations:^                   {                      [self setframe:cgrectmake(309, 147, 320,110)];                  }                   completion:^(bool finished)                   {                      if ( finished )                          /* animation done, something, or not */                          nslog(@"[%f, %f]", result.x, result.y);                 }]; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -