ios PullToRefresh using animated GIF or image array or Vector image

說說那些使人驚歎的下拉效果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);
}
View Code

github地址:https://github.com/phaibin/EGOTableViewPullRefresh/blob/master/Demo/TableViewPull/Classes/View/RefreshTableHeaderView/CircleView.m

相關文章
相關標籤/搜索