[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.viewContent.transform = CGAffineTransformMakeTranslation(0, -tranformValue);
} completion:^(BOOL finished) {
if (tranformValue < 0){
self.viewContent.hidden = YES;
}
}];
用这个动画的时候发现,不管怎样,都改不了动画时间,不管动画时间是多少,都会立即执行,解决办法是在加上主线程就可以了。
dispatch_async(dispatch_get_main_queue(), ^{
[UIViewanimateWithDuration:0.25 delay:0options:UIViewAnimationOptionCurveEaseInOutanimations:^{
self.viewContent.transform =CGAffineTransformMakeTranslation(0, -tranformValue);
} completion:^(BOOL finished) {
if (tranformValue < 0){
self.viewContent.hidden =YES;
}
}];
});
感谢 http://www.cocoachina.com/bbs/read.php?tid-165641-page-1.html。