Maz*_*yod 16 core-animation calayer cgcontext drawrect
我有一个UIView自定义形状绘制drawRect:.该frame属性设置为:
{5.f, 6.f, 50.f, 50.f}
Run Code Online (Sandbox Code Playgroud)
现在,我在图像上下文中渲染视图,但忽略了它的框架属性UIView,并始终UIView在左上角绘制.
[_shapeView.layer renderInContext:UIGraphicsGetCurrentContext()];
Run Code Online (Sandbox Code Playgroud)
我试图改变frame的CALayer,但什么都没有改变.修改bounds财产使事情变得更糟.我发现有用的唯一工作是:
CGRect frame = _shapeView.frame;
CGContextTranslateCTM(context, frame.origin.x, frame.origin.y);
[_shapeView.layer renderInContext:context];
Run Code Online (Sandbox Code Playgroud)
但是,当我处理许多形状时,这是不切实际的,我想只使用frame属性.
| 归档时间: |
|
| 查看次数: |
4735 次 |
| 最近记录: |