paint-code

Why is the hitTest / tap detection within a bezier path producing inaccurate results in the following scenario?

≡放荡痞女 提交于 2020-01-25 00:28:32
问题 I need to detect taps within a very specific area of my UI - a piano key that's at an angle, highlighted in blue here, but the way I have it currently set up, the detection is inaccurate: Since this isn't a simple rectangle, I can't just use a regular button. Instead, I decided to use the PaintCode plugin in order to create the bezier path directly from Sketch . Before you say this question is a duplicate: yes, I am aware of this question that was asked previously, and in fact I relied

PaintCode NSButton displays upside-down

前提是你 提交于 2019-12-24 12:28:38
问题 I am using PaintCode to create a button. I import the StyleKit, and create the NSButton Class for my RankView button. Like this: import Cocoa @IBDesignable class RankView: NSButton { override func drawRect(dirtyRect: NSRect) { super.drawRect(dirtyRect) StyleKit.drawRank2() // Drawing code here. } } But when I run the app, (and even in the storyboard), the button is upside-down. Like this: The arrow should be Up, but it points down. Whenever I change the parent class to NSView it displays

Dynamically change position based on scrollView

核能气质少年 提交于 2019-12-24 06:41:38
问题 I have a "U" shaped UIBezierPath which I use as the path for my myImage.layer to animate on. I also have a scrollView. My goal is to have a custom "Pull to Refresh" animation. The problem I am having is that I want my myImage.layer to update based on how much the scrollView scrolled. As the scrollView is pulled down, the myImage.layer animates along a "U" shape path . This is the path in my code which I created as a UIBezierPath . This is how I calculate how far the scrollView is pulled down:

Animating a bezier curve point

一个人想着一个人 提交于 2019-12-18 18:30:02
问题 I'm trying to animate a bezier curve I made with Paintcode (great app, btw) and am drawing in a custom UIView in the "drawRect" method. The drawing works fine but I want to animate a single point in the bezier curve. Here's my non-working method: -(void)animateFlame{ NSLog(@"Animating"); // Create the starting path. Your curved line. //UIBezierPath * startPath; // Create the end path. Your straight line. //UIBezierPath * endPath = [self generateFlame]; //[endPath moveToPoint: CGPointMake(167

Animating a bezier curve point

丶灬走出姿态 提交于 2019-12-18 18:29:31
问题 I'm trying to animate a bezier curve I made with Paintcode (great app, btw) and am drawing in a custom UIView in the "drawRect" method. The drawing works fine but I want to animate a single point in the bezier curve. Here's my non-working method: -(void)animateFlame{ NSLog(@"Animating"); // Create the starting path. Your curved line. //UIBezierPath * startPath; // Create the end path. Your straight line. //UIBezierPath * endPath = [self generateFlame]; //[endPath moveToPoint: CGPointMake(167

'blendedColorWithFraction:ofColor:' in iOS Swift and ObjC

邮差的信 提交于 2019-12-11 13:07:19
问题 I've got a simple gradient: 2 colors, 1 location. But it's spitting out code that can't work on UIColors: let gradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), [gradientColor2.CGColor, gradientColor2.blendedColorWithFraction(0.5, ofColor: gradientColor).CGColor, gradientColor.CGColor], [0.14, 0.5, 1])! 回答1: Here is the method implementation if you don't want to use StyleKit: extension UIColor { func blendedColorWithFraction(fraction: CGFloat, ofColor color: UIColor) ->

How to access a layer inside UIView custom class generate with Paintcode?

余生颓废 提交于 2019-12-08 08:59:22
问题 I'm using Paintcode V3 and last Xcode for my project. In Paintcode I draw a red path, kind of "clock hand" with a radius variable to be able to rotate it. In my Xcode project, this custom UIView is added to a main view. When the red path is rotating, I need to know when it intersects with another element of the view. I tried: if self.redPathView.frame.intersects(self.anotherView.frame) { //do something... } but it can't work because redPathView is the entire Paintcode canvas (the square frame

How to force SKTextureAtlas created from a dictionary to not modify textures size?

 ̄綄美尐妖づ 提交于 2019-12-08 06:32:33
问题 In my project, textures are procedurally generated from method provided by PaintCode (paint-code). I then create a SKTextureAtlas from a dictionary filed with UIImage generated by these methods : myAtlas = SKTextureAtlas(dictionary: myTextures) At last, textures are retrieve from atlas using textureNamed : var sprite1 = SKSpriteNode(texture:myAtlas.textureNamed("texture1")) But displayed nodes are double sized on iPhone4S simulator. And triple sized on iPhone 6 Plus simulator. It seems that

How to access a layer inside UIView custom class generate with Paintcode?

倾然丶 夕夏残阳落幕 提交于 2019-12-07 00:59:27
I'm using Paintcode V3 and last Xcode for my project. In Paintcode I draw a red path, kind of "clock hand" with a radius variable to be able to rotate it. In my Xcode project, this custom UIView is added to a main view. When the red path is rotating, I need to know when it intersects with another element of the view. I tried: if self.redPathView.frame.intersects(self.anotherView.frame) { //do something... } but it can't work because redPathView is the entire Paintcode canvas (the square frame) and not only the red path. I'm searching a way to access to the red path of my view. Interesting

Overlapping loader circle

我是研究僧i 提交于 2019-12-06 07:36:42
问题 I was trying to reproduce the overlapping circle Apple made for the application "Activity". (See image below). If you use standard Bezier Path the staring/ending position will have effects only between 0 and 2PI. If you try, for example, to fill for 4PI (even using some shadows) you cannot simulate an overlapping loading. How is possible to make something similar to the Apple solution to create an overlapping circle? 回答1: This shows the general idea--transform is definitely the way to go. You