UIScrollView中的UILabel中的像素化文本,均具有透明背景 [英] Pixelated text in UILabel within UIScrollView, both with transparent background

查看:52
本文介绍了UIScrollView中的UILabel中的像素化文本,均具有透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题:

我有一个UIScrollView,其背景是透明的.它的内部有一些带有透明背景和自定义字体的UILabel.

I have a UIScrollView whose background is transparent. Inside of it there are a few UILabels also with a transparent background and with a custom font.

首次显示滚动视图时,所有内容看起来都清晰而良好,但是一旦我开始平移滚动视图,标签的文本就会变得非常像素化.

When the scrollview is first displayed everything looks sharp and good but as soon as I start panning the scroll view, the text of the labels gets extremely pixelated.

如果我为标签设置了不透明的背景,则不会发生这种情况.

This does not happen if i set an opaque background to the labels.

您是否知道可能是什么原因造成的?

Do you have any idea what might be causing this?

推荐答案

这听起来像是您可能要在滚动显示的其他层的基础上添加几个相同的UILabel层.在将其添加到您的内容的代码上放置一个调试断点,并确保仅将其调用一次.

This sounds like you may be adding several layers of the identical UILabel on top of the others on scroll. Place a debug breakpoint on the code that adds it to your content, and ensure it is only being called once.

像素化"可能是由于抗锯齿像素重叠造成的.

The "pixelation" could be caused by the overlapping of anti-aliasing pixels.

这篇关于UIScrollView中的UILabel中的像素化文本,均具有透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆