小编Bah*_*nov的帖子

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

我是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, …
Run Code Online (Sandbox Code Playgroud)

core-animation ios pull-to-refresh

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

core-animation ×1

ios ×1

pull-to-refresh ×1