且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在UILabels中垂直居中嵌入字体?

更新时间:2022-06-03 09:53:59

我有一个自定义字体的问题,高字形,所以他们被标签剪切。已结束创建自己的标签子类与自创的CATextLayer。这可能听起来很极端,但实际上并不是那么多的工作,并给你完全控制定位,风格等。

I've had a problem with a custom font in iOS that had very tall glyphs so they were getting clipped by the label. Ended creating my own label subclass with self created CATextLayer. This may sound extreme, but isn't actually that much work, and gives you complete control on positioning, style etc.