ios - Animation of a view's subview hiding behind another view -


im trying animate uiimage subview of uiview in interface builder. problem is, animation goes "through" view table view , "goes behind" , doesn't show way. view hierarchy this:

view    view       subviewtoanimate    tableview 

i have tried [self.view bringviewtofront:subviewtoanimate] both in view itself, , in animation.

code animation:

-(void)startanimationwithimageview:(uiimageview*)imageview{      imageviewtomove = imageview;     imageviewfirstalpha = imageviewtomove.alpha;      firstcenterofview = imageviewtomove.center;      double firstx =self.parabelwidth*self.startvalue;     double firsty = self.parabelheight*pow(self.startvalue, 2);     firstpointofparabel = cgpointmake(firstx, firsty);      if (points) {         points = nil;     }     points =[[nsmutablearray alloc]init];      (int counter = self.startvalue; counter < self.stopvalue; counter++) {          double y = self.parabelheight*pow(counter, 2);         double x = self.parabelwidth*counter;          cgpoint point = cgpointmake(x, y);         [points addobject:[nsvalue valuewithcgpoint:point]];         //dlog(@"point: %@", nsstringfromcgpoint(point));      }      animationcounter = 0;     [self moveview];   }  -(void)moveview{      if (animationcounter < points.count) {         [uiview animatewithduration:self.duration                               delay:0                             options:uiviewanimationoptionbeginfromcurrentstate | uiviewanimationcurvelinear                          animations:^{                               nsvalue *val = [points objectatindex:animationcounter];                              cgpoint point = [val cgpointvalue];                               double delta = 1.0/points.count;                              imageviewtomove.center = cgpointmake(firstcenterofview.x-firstpointofparabel.x+point.x, firstcenterofview.y-firstpointofparabel.y+point.y);                              imageviewtomove.alpha = sqrt(imageviewtomove.alpha-delta);                               double scale = animationcounter*delta;                              imageviewtomove.transform = cgaffinetransformmakescale(sqrt(1-scale), sqrt(1-scale));                               animationcounter++;                           }                          completion:^(bool finished){                               [self moveview];                           }];     }else if (animationcounter == points.count) {         imageviewtomove.center = firstcenterofview;         imageviewtomove.transform = cgaffinetransformmakescale(1.0, 1.0);          [uiview animatewithduration:0.3                               delay:0                             options:uiviewanimationoptionbeginfromcurrentstate | uiviewanimationcurveeasein                          animations:^{                               imageviewtomove.alpha = imageviewfirstalpha;                           }                          completion:null];     }else         return;   } 

you can't use [self.view bringviewtofront:subviewtoanimate] put image view on top of table view because isn't sibling of table view.

if had...

view     subview     imageview (animated view)     tableview 

then code work.

or, in current hierarchy, bring subview front bring image view it.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -