Menu
  • HOME
  • TAGS

Can't set shadow on UICollectionViewCell and have rounded corners. Can only make one work at a time

ios,calayer,uicollectionviewcell,cgpath,cgpathref

After looking at the sample project that Timothy Moose was kind enough to share in the comments, I realized that I was literally doing everything almost exactly like he was. Out of frustration, I revisited my cell's nib file and it finally hit me. I had added a UIView to...

Equivalent of or alternative to CGPathApply in Swift?

swift,cgpath

UPDATE As of Xcode 7.0 beta (7A120f) with Swift 2.0, you can call CGPathApply entirely from Swift, but doing so is a little convoluted. Here's a wrapper, myPathApply, that does the appropriate magic: typealias MyPathApplier = @convention(block) (UnsafePointer<CGPathElement>) -> Void // Note: You must declare MyPathApplier as @convention(block), because //...

How to CGPath or SKShapeNode Rotation

ios,swift,sprite-kit,cgpath,skshapenode

let roadShape1 = SKShapeNode(ellipseInRect: CGRectMake(-100, -25, 200, 50)) roadShape1.strokeColor = UIColor.greenColor() roadShape1.lineWidth = 3 roadShape1.position = CGPoint(x:frame.midX, y: frame.midY) addChild(roadShape1) let roadShape2 = SKShapeNode(ellipseInRect: CGRectMake(-100, -25, 200, 50)) roadShape2.strokeColor = UIColor.greenColor() roadShape2.lineWidth = 3 let action2 = SKAction.rotateByAngle(CGFloat(M_PI)*0.75, duration:0) roadShape2.runAction(action2) roadShape2.position = CGPoint(x:frame.midX, y: frame.midY)...

SHGraphLineView remove a plot

ios,objective-c,cashapelayer,cgpath

So, by @Tejvansh Singh Chhabra's answer I managed to find a solution: First of all, I've added these 2 new methods to SHGraphLineView.h: /** * this methods will remove a plot from the graph. * * @param plot the Plot that you want to remove from the Graph. */ -...

Animate a view along just a part of a path in iOS

ios,core-animation,uibezierpath,cgpath

Look at the accepted answer here: Place images along a bezier path Once you have found points in the path you can make many subpaths of the same length and move animations along these...

Cannot release path created by CGPathCreateMutable in Swift

calayer,swift,cgpath

You don't need to release CF objects in Swift. In your case, the CGPathCreateMutable() returns a CGPath object (not CGPathRef) and is memory-managed just the same as any swift object. They explained this in the WWDC video Swift Interoperability In Depth

Drawing dashed line in Sprite Kit using SKShapeNode

swift,sprite-kit,cgpath,skshapenode

This is how you can draw a dashed line in swift. You can change the parameters as you want. let bezierPath = UIBezierPath() let startPoint = CGPointMake(0,250) let endPoint = CGPointMake(450,250) bezierPath.moveToPoint(startPoint) bezierPath.addLineToPoint(endPoint) var pattern : [CGFloat] = [10.0,10.0]; let dashed = CGPathCreateCopyByDashingPath (bezierPath.CGPath, nil,0,pattern,2); var shapeNode = SKShapeNode(path: dashed)...

frame.origin and bounds.size of CAShapeLayer are set to 0

ios,objective-c,uibezierpath,cashapelayer,cgpath

I figure it out. it's just to set the property bounds with the path.bounds. but this shrinks the shape and modify it's position when no bounds are set...

Spritekit PhysicsBody and Sprite don't line up

sprite-kit,cgpath,skphysicsbody

Modify your code line: line.physicsBody = [SKPhysicsBody bodyWithEdgeFromPoint:CGPointMake(pos1x, pos1y) toPoint:CGPointMake(pos2x, pos2y)]; to this: line.physicsBody = [SKPhysicsBody bodyWithEdgeFromPoint:CGPointMake(0, 0) toPoint:CGPointMake(pos2x-line.position.x, pos2y-line.position.y)]; Your problem is that you are not taking into account that the line physical body's coordinates are relative to the view coordinates. The documentation for bodyWithEdgeFromPoint:toPoint: clearly states that: Parameters...

how to join line with round corder

ios,cgcontext,cgpath

What you have is 2 straight lines, what you're asking for is (possibly 2 straight lines, joined by) an arc / bezier curve. Look at using CGPathAddArcToPoint or CGPathAddCurveToPoint or CGPathAddQuadCurveToPoint....

Does a scale-transform applied to a CGPath influence the rendering quality?

ios,image,uibezierpath,cgpath,image-quality

A UIBezierPath isn't a bitmap image. It is a made of coordinates that can be used for multiple operations such as : stroke, fill, hitTest, alphaMask, etc. When scaling your UIBezierPath, you are applying a geometric transformation on those coordinates. You can then perform one of the operations mentioned above...

Opposite of CGPathCreateCopyByStrokingPath?

ios,cgpath,cgpathref

I have determined that it does not make sense to return the fill portion of a path. While a path can be defined in such a way to draw a circle, rectangle or custom shape by filling an outline, it would be ambiguous to copy the fill portion to another...

SKShapeNode frame contains point (0, 0) even if CGPath does not

ios,objective-c,sprite-kit,cgpath,skshapenode

From my tests, it appears that unless you specifically set the node's position before creating your CGMutablePathRef, the starting point will always be (0,0). However, setting the node's position beforehand gives you the results you expected. SKShapeNode *shapeNodePos = [SKShapeNode node]; shapeNodePos.position = CGPointMake(50, 50); // <<< Set node's position...

Animation Along a Path with CAKeyframeAnimation

objective-c,core-animation,quartz-core,cgpath,cakeyframeanimation

Since you are creating the path using the planet bounds, the path will be relative to the planet position, but because your ship is not at the same point, it will move starting from its position. One quick way to fix it would be to move the ship to the...

Do I need to call 'CGPathRelease' manually in OC?

objective-c,core-graphics,cgpath

Yes you have to call CGPathRelease manually. Remember ARC does not manage Core Foundation objects. Here is some reading material

Zig zac path in sprite kit

swift,sprite-kit,cgpath

Try the following code to get a zig zag path using bezier curves. var cgpath: CGMutablePathRef = CGPathCreateMutable(); var xStart: CGFloat = CGFloat(200.0); var xEnd: CGFloat = CGFloat(200.0); var yStart : CGFloat = 0 var yEnd : CGFloat = self.size.height let numberOfIntermediatePoints = 10 let xOffset : CGFloat = 400...

How to create a CGPath which exactly match a CALayer bounds when the layer rotate or scale?

ios,calayer,cgpath

If I got your question right you could be using UIBezierPath's usesEvenOddFillRule to cut around your image layer bounds dimming the rest of the visible screen. Basically you create a very large rectangular path (for some reasons CGRectInfinite doesn't work here) and cut out the area around your image layer. The...

Sprite Kit: How to create infinite game background like 'Binary Rush' or 'Stay in the line'?

swift,sprite-kit,cgpath,skshapenode

Use the method you are using with ShapeNode. Instead of making the line width big, make another line that is essentially a copy of first line that is shifted over a particular amount of pixels. That will give you boundaries (like a road). You can set collision and contact events...