添加動(dòng)畫一 (上下包含法)beginAnimatioins
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0f]; // 時(shí)間間隔
[UIView setAnimationDelegate:self]; // 設(shè)置為代理還可以設(shè)置一些代理方法
[UIView setAnimationWillStartSelector:@selector(willStart)];
[UIView setAnimationDidStopSelector:@selector(stop)];
// 設(shè)置需要做的動(dòng)畫
[UIView commitAnimations];
添加動(dòng)畫二 block方法
[UIView animateWithDuration:2.0f animations:^{
// 設(shè)置需要做的動(dòng)畫
}];
添加動(dòng)畫三 block方法二
[UIView animateWithDuration:2.0f animations:^{
// 設(shè)置需要做的動(dòng)畫
} completion:^(BOOL finished) {
// 做完動(dòng)畫需要做什么事
}];
添加動(dòng)畫四 系統(tǒng)自帶對(duì)于某些特殊情況 - setContentOffset:animated;
CGPoint point = self.scrollView.contentOffset;
point.y = self.scrollView.frame.size.height;
[self.scrollView setContentOffset:point animated:YES];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。