
TitleLayer.frame = CGRectMake(0,80,imageVIEw.bounds.wIDth,50) subTitleLayer.frame = CGRectMake(0,130,40) TitleLayer.string = "Title" subTitleLayer.string = "SubTitle" let Fontname: CFStringRef = "HelveticaNeue" let FontSubname: CFStringRef = "HelveticaNeue-Thin" TitleLayer.Font = CTFontCreateWithname(Fontname,16,nil) subTitleLayer.Font = CTFontCreateWithname(FontSubname,10,nil) // Ignores the Font-size imageVIEw.layer.addSublayer(TitleLayer) imageVIEw.layer.addSublayer(subTitleLayer)
新字体是正确的,但它总是与TitleFont一样大小(16).如何@R_25_6502@大小?
看一下关于CATextLayer font property的这个说明If the Font property is a CTFontRef,a CGFontRef,or an instance
of NSFont,the Font size of the property is ignored.
它清楚地解释了CTFontRef的字体大小被忽略.要解决您的问题,您必须显式设置CATextLayer的FontSize属性
TitleLayer.FontSize = 16subTitleLayer.FontSize = 10总结
以上是内存溢出为你收集整理的swift – CATextLayer忽略font-size全部内容,希望文章能够帮你解决swift – CATextLayer忽略font-size所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)