• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Injecting text into a CALayer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Injecting text into a CALayer?


  • Subject: Re: Injecting text into a CALayer?
  • From: Jon Sigman <email@hidden>
  • Date: Fri, 15 Apr 2011 11:52:34 -0700 (PDT)

"self' is my circle object. I forgot to mention that I move the circles around
onscreen, so the text would ideally somehow be embedded within the circle
objects so they could track together. Would it make sense to have a parallel
CATextLayer associated with each CALayer in my circle object? Or does
CAShapeLayer have that capability?




________________________________
From: David Duncan <email@hidden>
To: Jon Sigman <email@hidden>
Cc: email@hidden
Sent: Fri, April 15, 2011 11:42:49 AM
Subject: Re: Injecting text into a CALayer?

On Apr 15, 2011, at 11:11 AM, Jon Sigman wrote:

> In iOS 4.3, I have an app that uses CALayers to draw small circles on the
>screen
>
> like so:
>
>  CALayer *_layer = [[CALayer alloc] init];
>  [_layer setDelegate:self];
>  [_layer setBounds:CGRectMake( 0,0,100,100 )];
>  [_layer setNeedsDisplay];
>
> Is there a way I can draw text into the circle regions? I'd like to label
them.

What is 'self' in the code above? Having the delegate draw the text would be the
simplest thing you can do. Next simplest would be to add a CATextLayer sublayer.
At a higher level however, you could do the exact same thing with UIViews and
use UILabel for your labels (which since they do less work for text layout are
generally faster).

--
David Duncan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Injecting text into a CALayer?
      • From: David Duncan <email@hidden>
References: 
 >Injecting text into a CALayer? (From: Jon Sigman <email@hidden>)
 >Re: Injecting text into a CALayer? (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Injecting text into a CALayer?
  • Next by Date: Re: Injecting text into a CALayer?
  • Previous by thread: Re: Injecting text into a CALayer?
  • Next by thread: Re: Injecting text into a CALayer?
  • Index(es):
    • Date
    • Thread