相关疑难解决方法(0)

Retina显示核心图形字体质量

试着理解为什么我用CGContextShowTextAtPoint获得低质量的绘图?见附图: IMG

字母"W"是在CALayer上使用CGContextShowTextAtPoint绘制的,看起来非常像素化.它旁边的按钮是一个标准按钮,按预期看起来很高.我想让文字绘图成为高分辨率.

在此输入图像描述

iphone core-animation core-graphics calayer ios

17
推荐指数
2
解决办法
6223
查看次数

IOS - 使用autolayout和drawRect

我正在使用autolayout,我有一个RoundView类(UIButton的子视图),其drawRect方法是:

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGFloat lineWidth = 0.0;
    CGContextSetLineWidth(context, lineWidth);
    CGContextSetFillColorWithColor(context, _currentBackgroundColor.CGColor);
    CGContextAddEllipseInRect(context, self.bounds);
    CGContextFillPath(context);

}
Run Code Online (Sandbox Code Playgroud)

然后我将它添加到self(一个UIView),使用autolayout设置其宽度和高度.一切看起来都很棒.但是当我改变它的大小限制(有更大的视图),并调用

[self layoutIfNeeded];
Run Code Online (Sandbox Code Playgroud)

在动画块中,圆形像素看起来更大更难看.

我这样做的方法是否正确?

正确 不正确

core-graphics drawrect uiviewanimation ios autolayout

0
推荐指数
1
解决办法
2976
查看次数