Questions tagged [catextlayer]

A CATextLayer is a Core Animation layer for showing text. It allows the displaying of simple and attributed strings as well.

A CATextLayer is a Core Animation layer for showing text. It allows the displaying of simple and attributed strings as well by assigning a CFString or CFAttributedStringto its property string.

Documentation:

140 questions
23
votes
4 answers

Resize CATextLayer to fit text on iOS

All my research so far seems to indicate it is not possible to do this accurately. The only two options available to me at the outset were: a) Using a Layout manager for the CATextLayer - not available on iOS as of 4.0 b) Use…
Dev Kanchen
  • 2,332
  • 3
  • 28
  • 40
14
votes
5 answers

how to set CATextLayer text vertical position?

I create UILabel and CATextLayer in my app using following code - (void)viewDidLoad { [super viewDidLoad]; self.textLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 90, 20, 20)]; self.textLabel.text = @"1"; self.textLabel.font =…
NOrder
  • 2,483
  • 5
  • 26
  • 44
12
votes
3 answers

UIScreen.mainScreen.scale on NSScreen

I have a problem with CATextLayer cleaning. and with iOS the solution is: textLayer.contentsScale = UIScreen.mainScreen.scale But I can't found "scale" property on cocoa NSScreen Note: Answer with Object-C or Swift are OK.
Huynh Inc
  • 2,010
  • 1
  • 25
  • 42
12
votes
4 answers

CATextLayer doesn't appear in an AVMutableComposition when running from a unit test

EDIT: The strangest thing: it seems that when running this code from a full app everything works, but I was always running the creation of the movie from my unit tests, and only there it didn't work. Trying to figure out why is that... I'm trying to…
yonix
  • 11,665
  • 7
  • 34
  • 52
10
votes
1 answer

CATextLayer ignores font-size

I would like to create an overlay of text to my images. The problem is, if ill try to add a second text, like a subtitle it ignores my font-size. titleLayer.frame = CGRectMake(0, 80, imageView.bounds.width, 50) subTitleLayer.frame =…
derdida
  • 14,784
  • 16
  • 90
  • 139
9
votes
4 answers

CATextlayer change size of FONT to fit the frame

I have a CATextlayer of a certain size and NSAttributedString text of unknown length. I need to adjust the font-size so the text fits the frame (not vice versa :) Any ideas where to start? :) [Edit] as nall points out, I can determine the string…
Swissdude
  • 3,486
  • 3
  • 35
  • 68
8
votes
1 answer

CATextLayer wrapped sizeToFit?

If I set textLayer.wrapped = YES, how do I resize textLayer to contain the wrapped text? I.e., how do I get the new height of the textLayer? Basically, I want something like -[UILabel sizeToFit].
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
8
votes
1 answer

CATextLayer and tracking / spacing between characters

I am using CATextLayer , in order to using a custom font in iOS , I know there is simple way to using custom font with Fonts provided by application but this is different font . I was wondering is there any way to change the spacing between each…
iOS.Lover
  • 5,923
  • 21
  • 90
  • 162
7
votes
2 answers

iOS CATextLayer wrapped doesn't work as expected

I have a CATextLayer with multiline Text. The wrapped option is set to YES. But it doesn't wrap the text on the last line. If I add another line with \n and a space, the wrapping occurs (but this destroys the layout). This only happens in iOS >=…
Swissdude
  • 3,486
  • 3
  • 35
  • 68
7
votes
4 answers

CATextlayer set line spacing?

I have a problem with CATextlayer. I set wrapped == YES for CATextlayer and it auto set multi line for this. But the line spacing is very small and look it verry bad. Is there any way to set line spacing for CATextlayer? Thanks.
Cong Tran
  • 1,448
  • 14
  • 30
6
votes
2 answers

How to change the text color in a CATextLayer in Swift

I want to change the text color of a CATextLayer. This does not work myTextLayer.textColor since there is no such property. I also got no response by setting the foreground color textLayer.foregroundColor = someColor.CGColor when the text layer…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
6
votes
1 answer

How to set system font for CATextLayer()?

For UILabel, I can set the system font as: label.font = UIFont.systemFontOfSize(18, weight: UIFontWeightMedium) For CATextLayer, is there a similar way to set the system font instead of giving the font name directly? textLayer = CATextLayer()…
Joe Huang
  • 6,296
  • 7
  • 48
  • 81
6
votes
1 answer

Create a CATextlayer that changes at an interval in an AVMutableVideoComposition

I have an app that allows a user to record a video in a mutable composition. I'd like to set some text that will come up and then change at an interval that I set when the user plays it back after an export. For example, if the first word is "dog",…
Orpheus Mercury
  • 1,617
  • 2
  • 15
  • 30
5
votes
2 answers

CoreAnimation CALayer and CATextLayer combination

I'am just playing around with CA lately. Now I am kind of stuck. This is the thing I want to animate: As for now I already got the circle animation working. I subclassed CALayer to make the animation. I really don't know where to go from here.…
danielreiser
  • 5,292
  • 5
  • 31
  • 43
5
votes
2 answers

How to correct UIView and UILabel text scaling with pixelation?

When I add a UILabel with text to a UIView and then scale the UIView, the contents is displayed with pixelation. The greater the scale factor, the greater the pixelation. I understand using a CATextLayer might be able to assist and could display the…
user4806509
  • 2,925
  • 5
  • 37
  • 72
1
2 3
9 10