在Imageview中绘制线条 [英] Draw Line in Imageview
本文介绍了在Imageview中绘制线条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在图像视图中画线?
请帮我。
解决方案
UIImageView用于显示现有图像。
它是UIView的子类。
最多直接绘制视图的方法是通过UIView:
UIView有一个-layer方法,可以访问视图的CALayer。
CALayer有一个方法-drawInContext:它接受在图层上绘制的CGContext。
如果你看一下参考CGContext [核心图形上下文],您将找到绘制各种内容的函数。
对于绘制线,您需要处理定义和填充路径的函数
How to Draw Line in Image View??
Pls needful for me.
解决方案
A UIImageView is for displaying an existing image.
It is a subclass of UIView.
The most direct way to draw to a view is via the UIView:
UIView has a -layer method that gives you access to the CALayer of the view.
CALayer has a method -drawInContext: that takes a CGContext that gets drawn on the layer.
If you look at the refrence for CGContext [Core Graphics Context], you will find functions for drawing various things.
For drawing lines, you want the functions that deal with defining and filling "paths".
这篇关于在Imageview中绘制线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文