2016-04-13 12 views
0

Ich habe eine App, in der ich viele Animationen mit einfachen In/Out-Kurven verwende. Ich benutze diese Funktion in allen Fällen: UIView animateWithDuration:delay:options:animations:completionUIView Animation Kurven funktionieren nicht für einige Animationen

All diese Animationen arbeiten ok, aber jetzt versuche ich, ein zu einer Schublade hinzuzufügen, die in und herausspringt, und aus irgendeinem Grunde diese besondere Animation ist immer linear:

[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 
    self.activityBar.view.frame = CGRectMake(0, self.activityBar.view.frame.origin.y, self.activityBar.view.frame.size.width, 20); 
} completion:nil]; 

Warum ist diese Animation linear, während andere Animationen mit der gleichen Option gekrümmt sind?

Dies ist die Ansichtshierarchie für self.activityBar.view

-UIViewController 
-UIViewController 
    -UIViewController (animation code lives here) 
    -UIViewController (activityBar) 
    -UIView (activityBar.view) 

Antwort

0
//Set old Frame for activityBar Here 

[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 
     [self.view layoutIfNeeded]; 
//Update to the new frame 
self.activityBar.view.frame = CGRectMake(0, self.activityBar.view.frame.origin.y, self.activityBar.view.frame.size.width, 20); 

    } completion:^(BOOL finished) { 

    }]; 
+0

self.view im OP nicht ... – Cbas

Verwandte Themen