Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was able to do what you are asking for below. Code is very rough, just spent a couple minutes on it, may have missed releases and what have you. You can simply swap the UILabel for a CATextLayer (used UILabel for brevity).</p> <pre><code> CAShapeLayer* circle = [[CAShapeLayer alloc] init]; CGMutablePathRef path = CGPathCreateMutable(); CGRect textRect = CGRectMake(self.bounds.size.width/4, (self.bounds.size.height-self.bounds.size.width/2)/2, self.bounds.size.width/2, self.bounds.size.width/2); float midX = CGRectGetMidX(textRect); float midY = CGRectGetMidY(textRect); CGAffineTransform t = CGAffineTransformConcat( CGAffineTransformConcat( CGAffineTransformMakeTranslation(-midX, -midY), CGAffineTransformMakeRotation(-1.57079633/0.99)), CGAffineTransformMakeTranslation(midX, midY)); CGPathAddEllipseInRect(path, &amp;t, textRect); circle.path = path; circle.frame = self.bounds; circle.fillColor = [UIColor clearColor].CGColor; circle.strokeColor = [UIColor blackColor].CGColor; circle.lineWidth = 60.0f; [self.layer addSublayer:circle]; CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; animation.duration = 15.0f; animation.fromValue = [NSNumber numberWithFloat:0.0f]; animation.toValue = [NSNumber numberWithFloat:1.0f]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; [circle addAnimation:animation forKey:@"strokeEnd"]; [circle release]; UILabel* label = [[UILabel alloc] init]; label.text = @"Test Text"; label.font = [UIFont systemFontOfSize:20.0f]; label.center = CGPathGetCurrentPoint(path); label.transform = CGAffineTransformMakeRotation(1.57079633); [label sizeToFit]; [self.layer addSublayer:label.layer]; CAKeyframeAnimation* textAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; textAnimation.duration = 15.0f; textAnimation.path = path; textAnimation.rotationMode = kCAAnimationRotateAuto; textAnimation.calculationMode = kCAAnimationCubicPaced; textAnimation.removedOnCompletion = NO; [label.layer addAnimation:textAnimation forKey:@"position"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload