Post

Replies

Boosts

Views

Activity

I have a class with an overridden method, and the method never gets called.
this is super frustrating.I have a class, it's one of hundreds.eariler today, it worked fine. I have made no changes. The editor seems to think I have overriden the superClass's method. (you can find that out by just doing it again and looking at the error messages)But, when I compile. my override is never called. In the OTHER subclasses it is called. I have cleaned and recompiled the entire project. I have re-written the method from scratch. I have copied the method from the super class, and pasted it into the subclass, adding the "override" key word.this is not the first time this has happened.
13
0
3.2k
Feb ’18
drawing into an existing CGImage
Ok, maybe I'm hung up on Mac OS X design patterns, just tell me if that's the case.the problem:I need to draw a line on an existing CGImage.There's no LockFocus methods for CGImage, There's no obvious documented way to get the already created Context of a Bitmap in the CGImage. There's no obvious or explicit code explaining the procedure.I have the reference to the image, I have the two points that make up the line, I know all of the code to draw that line... I just cannot make the context associated to that image, the current context. What gives? what is the design pattern? Please tell me where I can read about this.
3
0
2.6k
Aug ’16
autolayout is terrible
I have a very simple split view window. everything is laid out, but auot layout is screwing everything up.wish i knew why auto layout jacknifes my Ui.the splitview is the top level view in the window. it is horizontal, and there is a text field in the rightmost view in the splitview.the splitview is tied to the window top, bottom, trailing and leading.at that point, everything works as expected. when compiled, the split controls work just fine.the problem, is when I try to add constraints to the text box. I put top, leading and trailing constraints on. all to superview. IB actually reversed the first item and the second item in the top constraint, thought I caught the issue. But alas, nope. When I run the app, the splitview became a piece of crap. The split control allows you to drag it, but when you let go, it snaps to some point that it won't let go. It will not under any circumstances behave like a splitview any more. There is no justification, there is no reason, there is no logical argument for this kind of behavior. But now I need to dig through the documentation and try to understand the short comings of the autolayout engine. Ideas welcome.
7
0
2.8k
Sep ’15
SCNGeometry is difficult to instantiate
Hey. I've combed through the seriously weak documentation, looked for examples (none of which are in Swift) I found an Obj-C example and converted it. It doesn't work. It creates an empty hierarchy of SCNNodes. What is going on here? this is the third time, I've written SCNGeometry code from scratch, using examples from different sources, trying to follow the insanely arcane, undocumented, and openGL-ish design pattern. This time, I've taken Obj-C code, and simply converted it, leaving everything as close to the original as possible.what is going on?// BKPivotNode is a subclass of SCNNode. func genTubeTest(aPivot: BKPivotNode)->SCNNode{ var retNode = SCNNode() if aPivot.children.isEmpty != true{ for aChild in aPivot.childNodes{ if let bChild = aChild as? BKPivotNode { let sources = [SCNGeometrySource(vertices: [ SCNVector3(x: -1.0, y: -1.0, z: 0), SCNVector3(x: -1.0, y: 1.0, z: 0), SCNVector3(x: 1.0, y: 1.0, z: 0), SCNVector3(x: 1.0, y: -1.0, z: 0)], count: 4 ), SCNGeometrySource(normals: [ SCNVector3(x: 0.0, y: 0.0, z: -1.0), SCNVector3(x: 0.0, y: 0.0, z: -1.0), SCNVector3(x: 0.0, y: 0.0, z: -1.0), SCNVector3(x: 0.0, y: 0.0, z: -1.0)], count: 4 ), SCNGeometrySource(textureCoordinates: [ CGPoint(x: 0.0, y: 0.0), CGPoint(x: 0.0, y: 1.0), CGPoint(x: 1.0, y: 1.0), CGPoint(x: 1.0, y: 0.0)], count: 4 )] let newElement = SCNGeometryElement(data: NSData(bytes: [0, 2, 3,0,1,2], length: sizeof(Int)), primitiveType: .Triangles, primitiveCount: 2, bytesPerIndex: sizeof(Int)) let newGeo = SCNGeometry(sources:sources, elements:[newElement]) let newMat = SCNMaterial() newMat.diffuse.contents = NSColor.redColor() newMat.transparency = 0.5 newMat.doubleSided = true newGeo.firstMaterial = newMat; let newNode = SCNNode() newNode.geometry = newGeo retNode.addChildNode(newNode) } } } return retNode }
10
0
2.4k
Jul ’15