我正在使用 CATextLayer,为了在 iOS 中使用自定义字体,我知道有一种简单的方法可以使用自定义字体,Fonts provided by application
但这是不同的字体。我想知道有没有办法改变每个字符之间的间距?我没有找到任何财产这样做!
编辑:
- (void)viewWillAppear:(BOOL)animated {
CTFontRef font = [self newCustomFontWithName:@"yeki"
ofType:@"ttf"
attributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:16.f]
forKey:(NSString *)kCTFontSizeAttribute]];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
normalTextLayer_ = [[CATextLayer alloc] init];
normalTextLayer_.font = font;
normalTextLayer_.string = str;
normalTextLayer_.wrapped = YES;
normalTextLayer_.foregroundColor = [[UIColor purpleColor] CGColor];
normalTextLayer_.fontSize = 50.f;
normalTextLayer_.alignmentMode = kCAAlignmentRight;
normalTextLayer_.frame = CGRectMake(0.f,100.f, screenBounds.size.width, screenBounds.size.height /1.f);
[self.view.layer addSublayer:normalTextLayer_];
CFRelease(font);
}