草庐IT

CashApelayer

全部标签

ios - CALayer vs CGContext,哪个是更好的设计方法?

我一直在尝试使用iOS绘图。为了进行实际练习,我编写了一个BarChart组件。以下是类图(好吧,我不允许上传图片)所以让我用文字写一下。我有一个继承自UIView的NGBarChartView,它有2个协议(protocol)NGBarChartViewDataSource和NGBarChartViewDelegate。代码位于https://github.com/mraghuram/NELGPieChart/blob/master/NELGPieChart/NGBarChartView.m为了绘制条形图,我将每个条形图创建为不同的CAShapeLayer。我这样做的原因有两个,首先

ios - iOS 中的描边蒙版 CALayer

我正在尝试创建一个带有圆角和描边/边框的标签(或与此相关的任何其他View)。我可以使用以下代码实现前者:UIBezierPath*maskPath=[UIBezierPathbezierPathWithRoundedRect:self.label.boundsbyRoundingCorners:UIRectCornerBottomRightcornerRadii:CGSizeMake(16.0f,16.0f)];CAShapeLayer*shape=[CAShapeLayerlayer];shape.frame=self.label.bounds;shape.path=maskPat

ios - iOS 中的描边蒙版 CALayer

我正在尝试创建一个带有圆角和描边/边框的标签(或与此相关的任何其他View)。我可以使用以下代码实现前者:UIBezierPath*maskPath=[UIBezierPathbezierPathWithRoundedRect:self.label.boundsbyRoundingCorners:UIRectCornerBottomRightcornerRadii:CGSizeMake(16.0f,16.0f)];CAShapeLayer*shape=[CAShapeLayerlayer];shape.frame=self.label.bounds;shape.path=maskPat

ios - CAShapeLayer 中的多个路径

我想知道是否有可能让CAShapeLayer描边不止一条路径,因为实际上它只需要一条路径作为参数,例如:CAShapeLayer*myLayer=[CAShapeLayerlayer];myLayer.path=myBezierPath但是如果我想在该图层上绘制不止一条路径怎么办? 最佳答案 使用voidCGPathAddPath(CGMutablePathRefpath1,//Themutablepathtochange.constCGAffineTransform*m,//Apointertoanaffinetransforma

ios - CAShapeLayer 中的多个路径

我想知道是否有可能让CAShapeLayer描边不止一条路径,因为实际上它只需要一条路径作为参数,例如:CAShapeLayer*myLayer=[CAShapeLayerlayer];myLayer.path=myBezierPath但是如果我想在该图层上绘制不止一条路径怎么办? 最佳答案 使用voidCGPathAddPath(CGMutablePathRefpath1,//Themutablepathtochange.constCGAffineTransform*m,//Apointertoanaffinetransforma

ios - 为什么 CAShapeLayer 的描边会超出框架?

示例代码如下://CalledbyVC:HICircleView*circleView=[[HICircleViewalloc]initWithFrame:CGRectMake(0,0,100,100)];//initofcircleview-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){CAShapeLayer*borderLayer=[CAShapeLayerlayer];borderLayer.fillColor=[UIColorwhiteColor].CGColor;border

ios - 为什么 CAShapeLayer 的描边会超出框架?

示例代码如下://CalledbyVC:HICircleView*circleView=[[HICircleViewalloc]initWithFrame:CGRectMake(0,0,100,100)];//initofcircleview-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){CAShapeLayer*borderLayer=[CAShapeLayerlayer];borderLayer.fillColor=[UIColorwhiteColor].CGColor;border

ios - 环绕 UIView 的一些角并环绕 View 层的边框

我试图将UIView的底部两个角弄圆,并使图层的边框也显示为圆角。我目前正在做:UIRectCornerscorners=UIRectCornerBottomLeft|UIRectCornerBottomRight;CGSizeradii=CGSizeMake(kThisViewCornerRadius,kThisViewCornerRadius);UIBezierPath*path=[UIBezierPathbezierPathWithRoundedRect:myView.boundsbyRoundingCorners:cornerscornerRadii:radii];CAShap

ios - 环绕 UIView 的一些角并环绕 View 层的边框

我试图将UIView的底部两个角弄圆,并使图层的边框也显示为圆角。我目前正在做:UIRectCornerscorners=UIRectCornerBottomLeft|UIRectCornerBottomRight;CGSizeradii=CGSizeMake(kThisViewCornerRadius,kThisViewCornerRadius);UIBezierPath*path=[UIBezierPathbezierPathWithRoundedRect:myView.boundsbyRoundingCorners:cornerscornerRadii:radii];CAShap

ios - 如何使用 CAShapeLayer 使我的 UIBezierPath 动画化?

我正在尝试为UIBezierPath制作动画,并且我已经安装了CAShapeLayer来尝试执行此操作。不幸的是,动画不工作,我不确定任何层是否有任何影响(因为代码正在做与我拥有层之前所做的相同的事情)。这是实际代码-希望得到任何帮助。Draw2D是嵌入在UIViewController中的UIView的实现。所有绘图都发生在Draw2D类中。调用[_helpercreateDrawing...]只是用点填充_uipath变量。Draw2D.h定义了以下属性:#definedefaultPointCount((int)25)@propertyDraw2DHelper*helper;@p