English 中文(简体)
文本:用模版制作图像
原标题:renderInContext: producing an image with blurry text

我正在预示一个混合图像,同时附上不同的UIImageView和IDLabels,以加快在大张桌上进行滚动。 不幸的是,与其它工匠相比,统一工薪制度的主要工作是看一看一.。

The black letters "PLoS ONE" are in a UILabel, and they look much blurrier than the words "Medical" or "Medicine". The logo "PLoS one" is probably similarly being blurred, but it s not as noticeable as the crisp text.
The entire magazine cover is a single UIImage assigned to a UIButton.

PLoS ONE label is blurry than "Medical Special" and "Medicine (Gener)"
(source: karlbecker.com)

This is the code I m using to draw the image. The magazineView is a rectangle that s 125 x 151 pixels. I have tried different scaling qualities, but that has not changed anything. And it shouldn t, since the scaling shouldn t be different at all. The UIButton I m assigning this image to is the exact same size as the magazineView.

    UIGraphicsBeginImageContextWithOptions(magazineView.bounds.size, NO, 0.0);
    [magazineView.layer renderInContext:UIGraphicsGetCurrentContext()];
    [coverImage release];
    coverImage = UIGraphicsGetImageFromCurrentImageContext();
    [coverImage retain];
    UIGraphicsEndImageContext();

Any ideas why it s blurry?

当我开始一个形象环境,使之正确时,是否在哪怕是 p子上发生,或者我是否需要人工确定造成这种情况的发生地点?

问题回答

确保你的标签坐标是惯用的价值观。 如果这些数字不是全部数字,就会显得模糊不清。

我想你需要利用CGRectIntegral提供更多信息,请见:。 如何使用CGRectIntegral?


今天,我遇到同样的问题,我的内容在我从国际劳工联合会的文稿中产生形象时被混为一谈。

1. 我们使用<条形码>构造,将绘画环境用于绘制一个轨道图,接受三个参数:

<代码>: 新蓝图范围的规模。 这表明法国地理统计局的图像规模。

www.un.org/spanish/ga/president A Boolean国旗,表明轨道图是否为不透明。 如果不透明参数为YES,那么甲型频道就被忽视,而轨道图则被视为完全不透明。

。 适用于轨道图的比额表系数。 如果你具体说明了0.0值,则该比额表因数将计入该装置主屏幕的大小系数。

因此,我们应当在装置显示方面使用适当的比例系数(1x、2x、3x),以解决这个问题。

快速5版

UIGraphicsBeginImageContextWithOptions(frame.size, true, UIScreen.main.scale)
if let currentContext = UIGraphicsGetCurrentContext() {
    nameLabel.layer.render(in: currentContext)
    let nameImage = UIGraphicsGetImageFromCurrentImageContext()
    return nameImage
}




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签