Tag: 石英核心

核心animation警告:“未提交的CATransaction”

我只收到以下警告: CoreAnimation: warning, deleted thread with uncommitted CATransaction; created by: 0 QuartzCore 0x3763c65d <redacted> + 220 1 QuartzCore 0x3763c541 <redacted> + 224 2 QuartzCore 0x3763fe2f <redacted> + 30 3 QuartzCore 0x3763b9bf <redacted> + 318 4 QuartzCore 0x3763b87b <redacted> + 50 5 QuartzCore 0x3763b80b <redacted> + 538 6 MyApp 0x000df597 -[CommonClass orangeGradient:] + 382 7 MyApp […]

无法将types'CFString'的值转换为期望的参数types'UnsafePointer <Void>'(又名'UnsafePointer <()>')

当我定义行时,出现构build错误 let runFont : CTFontRef = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName) 错误是:无法将types'CFString'的值转换为期望的参数types'UnsafePointer'(又名'UnsafePointer <()>')

无法在CADisplayLink渲染循环中绑定EAGLDrawable

我使用CADisplayLink渲染循环callback来渲染一系列openGL的图像纹理。 在CADisplayLink的第一个callback调用后,我只是得到这些错误输出 Failed to bind EAGLDrawable: <CAEAGLLayer: 0x946bb40> to GL_RENDERBUFFER 2 Failed to make complete framebuffer object 8cd6 我设置了renderBuffer&frameBuffer并在控制器的viewDidLoad阶段中调用glFramebufferRenderbuffer,glCheckFramebufferStatus的返回在该阶段没有问题。 这是我正在使用的代码。 //GLKViewController.m typedef struct { GLKVector3 positionCoords; GLKVector2 textureCoords; }SceneVertex; static const SceneVertex vertices[] = { {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, // lower left corner {{ 1.0f, -1.0f, 0.0f}, {1.0f, 0.0f}}, // lower right corner {{-1.0f, […]

UIView animateWithDuration不在ios8中animation

我已经实现了一个自定义的segue类来模拟没有导航栏的push过渡。 诀窍是采取快照,将它们添加到视图,replaceviewController,移动快照,并最终删除它们。 这模仿了viewController的水平移动,但实际上只有两个UIImagesView被移动。 下面的代码实现了这一点。 self.destinationImageView.frame = offsetFrameD; self.sourceImageView.frame = offsetFrameS; //ViewController replacement [self.sourceViewController presentModalViewController:self.destinationViewController animated:NO]; //Overpose the snapShot who will simulate the transition between vies. [destinationView addSubview: self.sourceImageView]; [destinationView addSubview: self.destinationImageView]; [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.destinationImageView.frame = self.finalFrameD; self.sourceImageView.frame = self.finalFrameS; } completion:^(BOOL finished) { [self.sourceImageView removeFromSuperview]; [self.destinationImageView removeFromSuperview]; }]; 此代码与iOS 7一起工作。但是,使用iOS 8时,似乎不执行animation。 destinationImageView和sourceImageView直接移动到finalPosition(WITHOUT […]

如何在iOS中使用弧形边缘绘制弧形?

在我的应用程序之一,我想绘制一个带圆angular的渐变弧。 像下面的图片 这是我迄今为止使用下面的代码所做的。 -(void)startArc { UIBezierPath *roundedArc = [self arcWithRoundedCornerAt:centerPoint startAngle:DEGREES_TO_RADIANS(-90) endAngle:DEGREES_TO_RADIANS(90) innerRadius:width-20 outerRadius:width cornerRadius:0]; CAShapeLayer *mask = [CAShapeLayer new]; [mask setPath:roundedArc.CGPath]; [mask setFrame:_outerView.bounds]; [mask setShouldRasterize:YES]; [mask setRasterizationScale:[UIScreen mainScreen].scale]; CAGradientLayer *gradient = [CAGradientLayer new]; [gradient setFrame:_outerView.bounds]; // [gradient setColors:[NSArray arrayWithObjects:(id)[[UIColor colorWithRed:0.86 green:0.91 blue:0.96 alpha:1.0f] CGColor],(id)[[UIColor colorWithRed:0.98 green:0.99 blue:0.99 alpha:1.0f] CGColor], nil]]; [gradient setColors:[NSArray arrayWithObjects:(id)[UIColor colorWithRed:0.19 […]

CAShapeLayeranimation(从0到最终大小的弧)

我有一个使用UIBezierPath添加弧的UIBezierPath 。 我在这里看到了几个post(实际上是一个),但似乎没有给我答案。 正如标题所说,我想animation弧(是的,这将是一个饼图)。 怎样才能完成一个从“空”到完全扩展的animation? 有点像弯曲的进度条。 真的不可能通过CoreAnimation来实现吗? 这是我如何“做”的弧。 哦,忽略评论和计算,因为我用来逆时针单位圆和苹果顺时针。 弧线显得很好,我只需要animation: //Apple's unit circle goes in clockwise rotation while im used to counter clockwise that's why my angles are mirrored along x-axis workAngle = 6.283185307 – DEGREES_TO_RADIANS(360 * item.value / total); //My unit circle, that's why negative currentAngle [path moveToPoint:CGPointMake(center.x + cosf(outerPaddingAngle – currentAngle) * (bounds.size.width […]

CAReplicatorLayer背后的魔法是什么?

我觉得CAReplicatorLayer有趣: 它可以非常有效地用不同的变换多次显示一个CALayer(怎么样?) 似乎它以某种方式重复使用复制图层的“后备存储”,甚至对其应用一些颜色色彩(如何?) 我想获得源代码或获得一些关于CAReplicatorLayer背后魔法的知识。 我想有一个类似于CAReplicatorLayer的CALayer类,但有更多的控制权。 我想单独控制 每个复制实例 的转换 。 所以问一个完全不同的方式:是否有可能获得一个CALayer的“支持商店”,然后显示它,但我想要多less次? (通过“支持存储”我的意思是为CALayer / UIView渲染的纹理。我不知道什么是在CoreAnimation / QuartzCore的引擎盖下发生了什么)。 为什么我没有在寻找替代品,例如将CALayer渲染为UIImage: 性能 在转换过程中,内容是dynamic/变化的 这将是双手可怕的做它的另一种方式!

如何访问Swift中的iOS私有API?

我怎样才能调用非公开的iOSfunction,并从Swift访问非公有的特性? 具体来说,我想在QuartzCore框架中使用一个非公共类。 我想到的一个解决scheme是创build“桥接”Objective-C项目,将这些非公开的API封装到公共API中,而不是从Swift中调用这个Objective-C函数。 不过,我的解决scheme现在是纯Swift,我宁愿保持这种方式。 还有没有更加坚定的方法? (例如添加一些Objective-C桥接头文件 ) 注: 我知道你在想什么,私人API是私人的,因为它们不应该被使用。 我知道风险,我知道所有的地方,应用程序商店的限制等。毕竟,仔细考虑和大量的研究,不幸的是,似乎仍然是在这种情况下最好的办法。

Objective-C:截取自定义框架内所有视图的截图

我有一个游戏,用户可以创build自定义关卡并将其上传到我的服务器以供其他用户玩,我希望在用户testing自己的关卡之前获得“行动区域”的截图,以便上传到我的服务器一个“预览图像”。 我知道如何获得整个视图的截图,但我想将其定义为自定义框架。 考虑下面的图片: 我只想把这个区域的截图做成“行动区”。 我能做到吗?