相关疑难解决方法(0)

如何在不损失视网膜显示质量的情况下将UIView捕获到UIImage

我的代码适用于普通设备,但在视网膜设备上会产生模糊图像.

有人知道我的问题的解决方案吗?

+ (UIImage *) imageWithView:(UIView *)view
{
    UIGraphicsBeginImageContext(view.bounds.size);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;
}
Run Code Online (Sandbox Code Playgroud)

image-capture scale uikit uiimage retina-display

293
推荐指数
9
解决办法
15万
查看次数

如何从UILabel创建图像?

我目前正在iphone上开发一个简单的Photoshop应用程序.当我想展平我的图层时,标签处于良好的位置,但字体大小不好.这是我的代码扁平化:

UIGraphicsBeginImageContext(CGSizeMake(widthDocument,widthDocument));

for (UILabel *label in arrayLabel) {
    [label drawTextInRect:label.frame];
}

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)

有人可以帮帮我吗?

iphone objective-c flatten uiimage uilabel

23
推荐指数
3
解决办法
1万
查看次数