我有一個小橫槓,從一側到另一側的設備。 當用戶點擊這個欄時,我想讓她成長起來。所有測試,我做了酒吧增長向下,或者當我改變origin.y和大小。高速酒吧太快到新的位置,然後增長到底部的正確位置。我無法制作出平滑的動畫。UIView成長動畫
示例代碼:
__weak typeof(self) weakSelf = self;
int sizeToGrow = 100;
CGRect barFrame = CGRectMake(weakSelf.frame.origin.x,
weakSelf.frame.origin.y - sizeToGrow,
weakSelf.frame.size.width,
weakSelf.frame.size.height + sizeToGrow);
[UIView animateWithDuration:0.7
delay:0
options: UIViewAnimationOptionCurveEaseOut
animations:^{
weakSelf.frame = barFrame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
你嘗試'UIViewAnimationOptionCurveLinear'呢? – Taum
是啊,我試過所有動畫選項= S – tschleuss