在iOS6中拉动像邮件一样刷新动画

在iOS6中拉动像邮件一样刷新动画,第1张

概述我是iOS开发人员,最近我安装了最新的iOS 6进行测试.当我遇到邮件拉动刷新动画时,我决定尝试自己实现它.我试图使用带有UIBezierPath的CAShapeLayer来创建可以向前拖动的相同椭圆形状.并且为了使向下部分向下伸展,我试图使用添加两个控制点的曲线并应用CABasicAnimation.但不幸的是,结果并不像我预期的那样.由于拉伸的线条内部有一点椭圆形.我想椭圆动画必须与其他类做一 我是iOS开发人员,最近我安装了最新的iOS 6进行测试.当我遇到邮件拉动刷新动画时,我决定尝试自己实现它.我试图使用带有UIBezIErPath的CAShapeLayer来创建可以向前拖动的相同椭圆形状.并且为了使向下部分向下伸展,我试图使用添加两个控制点的曲线并应用CABasicAnimation.但不幸的是,结果并不像我预期的那样.由于拉伸的线条内部有一点椭圆形.我想椭圆动画必须与其他类做一些事情.如果有人能引导我在这里提出一些想法,我将非常感激.
非常感谢
- (UIBezIErPath *)createCircleForRect:(CGRect)bRect{    UIBezIErPath *circle = [UIBezIErPath bezIErPath];    CGfloat rectWIDth = bRect.size.wIDth;    CGfloat rectHeight = bRect.size.height;    minSize = MIN(rectWIDth,rectHeight);    //center = CGPointMake(minSize/2.0f,minSize/2.0f);    CGfloat radius = minSize/2.0f - 5.0f;    startPointOffset = center.x - radius;    if(startPointOffset == 5.0f)        testVal = 0;    else         testVal += startPointOffset;    NSLog(@"startPointOffset =>> %f",startPointOffset);    NSLog(@"radius =>> %f",radius);    NSLog(@"after center =>> %f,%f",center.x,center.y);    [circle addArcWithCenter:center radius:radius startAngle:degrees_TO_radians(0) endAngle:degrees_TO_radians(180) clockwise:NO];    [circle movetoPoint:CGPointMake(startPointOffset,center.y)];    [circle addCurvetoPoint:CGPointMake(center.x + radius,center.y) controlPoint1:CGPointMake(center.x - radius,rectHeight + 10.0f) controlPoint2:CGPointMake(center.x + radius,rectHeight + 10.0f)];    [circle closePath];    return circle;}-(voID)startAnimation{       CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];    animation.duration = 1.0;    animation.repeatCount = HUGE_VALF;    animation.autoreverses = YES;    animation.timingFunction = [camediatimingFunction functionWithname:kcamediatimingFunctionEaseInEaSEOut];    animation.fromValue = (ID)roundBPath;    CGRect smallerRect = self.frame;    smallerRect.size.height += 50;    smallerRect.size.wIDth -= 80;    UIBezIErPath *newRound = [self createCircleForRect:smallerRect];    animation.tovalue = (ID)(newRound.CGPath);    [shapeLayer addAnimation:animation forKey:@"animatePath"];}
解决方法 iOS 6 Mail中的pull-to-refresh控件是任何应用程序都可以使用的标准UIKit控件:请参阅UItableVIEwController上的 refreshControl属性和 UIRefreshControl类. (另请注意,您可以通过为表视图控制器选择“Refreshing – > Enabled”在XCode 4.5上的IB中设置一个.)

不过,如果您要部署到iOS 5或更早版本,ODRefreshControl是一个不错的选择.

总结

以上是内存溢出为你收集整理的在iOS6中拉动像邮件一样刷新动画全部内容,希望文章能够帮你解决在iOS6中拉动像邮件一样刷新动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1102372.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存