I'm having trouble getting my head around how to define certain sections of a catextlayer in different sizes, colours and how to add line breaks?
I need to format a page of text like so:
Title (in size 20 HelveticaNeue-Light, black)
/n line break
Para 1 (in size 15 HelveticaNeue-Light, black)
/n line break
para 2 (in size 15 HelveticaNeue-Light, custom colour)
At the moment all I have is the title text, can anyone help me out?
CATextLayer *TextLayer = [CATextLayer layer];
TextLayer.bounds = CGRectMake(0.0f, 0.0f, 245.0f, 290.0f);
TextLayer.string = @"Title";
CTFontCreateWithName((CFStringRef)@"HelveticaNeue-Light", 0.0, NULL);
TextLayer.backgroundColor = [UIColor blackColor].CGColor;
TextLayer.position = CGPointMake(162.0, 250.0f);
TextLayer.wrapped = YES;
TextLayer.fontSize = 20;
[self.view.layer addSublayer:TextLayer];
Sounds like you want to use attributed strings. If you have an Apple Developer account you can learn more in the docs.