Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 通过xcode 6中的quartz2D图形提供图层内容_Ios_Objective C_Xcode_Cocoa_Xcode6 - Fatal编程技术网

Ios 通过xcode 6中的quartz2D图形提供图层内容

Ios 通过xcode 6中的quartz2D图形提供图层内容,ios,objective-c,xcode,cocoa,xcode6,Ios,Objective C,Xcode,Cocoa,Xcode6,Hi根据,您可以通过调用自定义图层类并手动编写显示方法来提供图层内容。我想在内容中使用quartz2D绘图(在使用quartz的单独自定义类中编写),但我不知道如何使用 我在这里尝试使用显示方法 -(void) displayLayer: (CALayer *)layer inContext:(CGColorSpaceRef)ctc inContext:(CGContextRef)ctx {} quartz2D绘图方法 -(void)drawRect:(CGRect)rect{ CGCon

Hi根据,您可以通过调用自定义图层类并手动编写显示方法来提供图层内容。我想在内容中使用quartz2D绘图(在使用quartz的单独自定义类中编写),但我不知道如何使用

我在这里尝试使用显示方法

-(void) displayLayer: (CALayer *)layer inContext:(CGColorSpaceRef)ctc  inContext:(CGContextRef)ctx {}
quartz2D绘图方法

-(void)drawRect:(CGRect)rect{
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetLineWidth(上下文,2.0);
CGContextSetStrokeColorWithColor(上下文[UIColor blueColor].CGColor);
CGRect矩形=CGRectMake(60170200,80);
CGContextAddRect(上下文,矩形);
CGContextStrokePath(上下文);

}
你把方法签名搞混了。而不是:

-(void)显示层:(CALayer*)层
inContext:(CGColorSpaceRef)ctc inContext:(CGContextRef)ctx{}

你应使用:

-(void)绘图层:(CALayer*)文本层:(CGContextRef)ctx


让我知道这是否是真正的问题。我很乐意提供一个工作示例。

问题是我的自定义层不会显示在视图中,因此我无法对其设置动画,我将层的子类更改为CALayer,并将视图控制器中的UIView指定给它,从而修复了该问题。虽然现在我正在处理一个“libc++abi.dylib:以NSException(lldb)类型的未捕获异常终止”错误,其中应用程序在启动时崩溃。