说说那些使人惊叹的下拉效果git
1. 动画下拉,这里借用一下github的资源github
优势:直接用gif图处理,下拉进度彻底按照gif图运行时间,只要时间和下拉进度匹配就能够了, 效果很流畅ide
https://dribbble.com/shots/1418440-Twisted-gif?list=searches&tag=animated_gif&offset=3 动画
这里有大堆gif资源可供下载参考spa
项目地址:https://github.com/uzysjung/UzysAnimatedGifPullToRefreshcode
2.矢量图处理orm
项目参考地址:https://github.com/nicolastinkl/TKRefereshTableHeaderViewblog
优势:经过gpu渲染而成,效果可想而知。使用时调节矢量图比较麻烦资源
3. 最多见的圆圈进度填满之类的效果get
这种就比较简单。 直接经过UIView -DrawRect便可实现
// Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 1.0); CGContextSetLineCap(context, kCGLineCapRound); CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); CGFloat startAngle = -M_PI/3; CGFloat step = 11*M_PI/6 * self.progress; CGContextAddArc(context, self.bounds.size.width/2, self.bounds.size.height/2, self.bounds.size.width/2-3, startAngle, startAngle+step, 0); CGContextStrokePath(context); }