Archive for the 'Objective C' Category

Another creator pattern for clusters

Thursday, September 15th, 2011

This is about Cocoa, and in particular about class clusters. The problem I wanted to solve was having a class cluster with easily extendable hierarchy without too much interdependency. In my case, I want to create a number of different UITableViewCell descendants, depending on the particular data element the cell should handle. If the data […]

Don’t do parts.parts

Wednesday, November 17th, 2010

I just found another weirdness in Apple’s Objective C. If you have the same name for several components of an object path, the runtime starts stuttering and behaving very badly. Intermittently, you can’t scroll, or only extremely slowly, everything turns into molasses. No errors, mind, just mindbogglingly slow. This stuttering and slowness seems to affect […]

Is it nil or isn’t it?

Monday, October 4th, 2010

A bit of Objective-C weirdness I don’t quite get. The weirdness occurs if “view” in the code below is nil, that is if [idr getAsView:newFrame] returns nil. You’d expect the verticalOffset not to be incremented, but it is. Even though view is nil, view.frame.size.height still evaluates to “21″ (in this case) and verticalOffset gets incremented. […]