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
5
votes
0 answers

CATextLayer ignores NSShadow?

I have a custom UIView that I've created that has several custom UIControl instances which are non-rectangular buttons (instead of using UIButton instances). I am doing this because I need to be able to draw non-rectangular buttons and have them…
mbm29414
  • 11,558
  • 6
  • 56
  • 87
5
votes
1 answer

What to do with CATextLayer to have the same font displayed as the system font in UILabel?

When I use UILabel, I set the system font as: label.font = UIFont.systemFontOfSize(18, weight: UIFontWeightMedium) Now I try to use CATextLayer and I searched online and found out that the system font for iOS 9 is San Francisco and the font name is…
Joe Huang
  • 6,296
  • 7
  • 48
  • 81
5
votes
1 answer

CATextLayer + NSAttributtedString + CTParagraphStyleRef

I want to have some text with a custom line-spacing, so I wrote an attribute string with CTParagraphStyleAttributte and pass it to my CATextLayer: UIFont *font = [UIFont systemFontOfSize:20]; CTFontRef ctFont =…
nacho4d
  • 43,720
  • 45
  • 157
  • 240
4
votes
0 answers

AVMutableVideoComposition With CATextLayer Ending Up With No Text String

I'm trying to insert a text layer (CATextLayer) to a movie. To begin with, let me insert a text layer (CATextLayer) to a wired NSView object like let myLayer = CALayer() let textLayer = CATextLayer() let text = "Hello, Mr. Jordan. How are you…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
4
votes
1 answer

Figuring out the size of the textBox in a CATextLayer

I wrote this code, works well; but I need to figure out the size of the text in the CATextLayer to finish it? The idea I use from a tap gesture to get the x/y, enter the text and have it figure out the CGSize needed to draw it in the CATextLayer…
user3069232
  • 8,587
  • 7
  • 46
  • 87
4
votes
0 answers

how to add border outline stroke and fill stroke on CATextLayer text

Here is code, text1 =[[NSMutableAttributedString alloc]initWithAttributedString:t.string]; NSDictionary* attributes = @{(NSString*)kCTStrokeWidthAttributeName: @(-slider.value), …
4
votes
4 answers

CATextLayer gets rasterized too early and it is blurred

I have some troubles with CATextLayer, that could be due to me, but I didn't find any help on this topic. I am on OS X (on iOS it should be the same). I create a CATextLayer layers with scale factor > 1 and what I get is a blurred text. The layer is…
mbt
  • 155
  • 10
4
votes
1 answer

Drawn text on a CALayer does not appear or crashes at runtime

I have a CALayer on which I draw some stuff at first and then a text: - (void)drawInContext:(CGContextRef)context { CGContextSaveGState(context); // draw things, everything displays correctly ... CGSize expectedCreditSize =…
clash
  • 532
  • 4
  • 17
4
votes
5 answers

Unwanted Vertical Padding from iOS 6 on CATextLayer

Background: I started my project in iOS 5 and built out a beautiful button with layer. I added a textLayer onto the button and center it using the following code: float textLayerVerticlePadding = ((self.bounds.size.height - fontSize) /2); …
Byte
  • 2,920
  • 3
  • 33
  • 55
3
votes
2 answers

CATextLayer rotate?

This should really work, but is not: CATextLayer* textLayer = [CATextLayer layer]; textLayer.string = @"text"; [textLayer setValue:[NSNumber numberWithDouble:M_PI / 2.f forKey:@"transform.rotation"]; [self addSublayer:textLayer]; in fact, when i…
olynoise
  • 2,016
  • 2
  • 19
  • 32
3
votes
1 answer

Multiline CATextLayer with truncation

Is there a way to make a CATextLayer show the "..." if I have wrapped == YES?
rp90
  • 854
  • 1
  • 9
  • 20
3
votes
0 answers

CATextLayer/NSAttributedString - Determine exact size of the shown text

I've got a CATextLayer with an NSAttributedString and I want to calculate the exact size of the visible/drawn text. I have tried this: http://www.taffysoft.com/pages/20120202-01.html But it gives the same result for the string "1" and "5", even if…
Max
  • 2,699
  • 2
  • 27
  • 50
3
votes
2 answers

Smooth scrolling UIScrollView with transparent CALayers

I'm working on an iPhone app which will be displaying large scrollable and zoomable surface containing a grid of pictures and text labels over them. I need to be able to change the position of pictures individually and control the opacity level of…
qbba.lys
  • 73
  • 6
3
votes
1 answer

Dynamically change text of CATextLayer

I've been banging my head off a wall trying to figure this problem out. I've added a CATextLayer to a CALayer and after a couple of operations happen i want to change the text of the CATextLayer to something different. Is there a simple way to do…
user1179321
  • 797
  • 1
  • 10
  • 24
3
votes
0 answers

don't reload/refresh Layer and CATextLayer (iphone)

I have layer and CATextLayer. I have code, e.g: CATextLayer *TextLayer = [CATextLayer layer]; TextLayer.bounds = CGRectMake(0.0f, 0.0f, 245.0f, 290.0f); TextLayer.string = randomText; …
sebob
  • 515
  • 6
  • 14
1
2
3
9 10