Monthly Archives: June 2010

Fast numeric queries

This post introduces a relatively new algorithm, along with an open-source demo iPad app, that can pre-process a large set of numeric data to help perform extremely fast error-tolerant lookups at query time. Problems you can solve There is a class of algorithms known as locality-sensitive hashing (LSH) algorithms; this is a new one of […]

Clash-happy method names

This post lists a few special-case method names that are somewhat likely to be used accidentally by you but can only be used correctly if you understand their built-in functions.  Specifically: class, description, load, and hash. Why it’s tricky, by example Here’s an easy way to mess this up: start with a model object meant […]

Drag and drop in 3 lines

This post introduces the PuttyView class, which is built to act like a moveable and resizable window-like object in iOS.  It contains one primary view, called the contentView, and moves and resizes that view according to where the user drags their finger. (Source code link at the bottom.) Drag and drop in 3 lines Probably […]

Hacking the responder chain

This post could have also been called “How to allow user interaction with views beneath other views,” but that title is a little too long. I’m going to assume you have at least some idea of what the responder chain is for this post. (There’s an example xcode project below for those who like to […]

Custom objects as NSDictionary keys

This post describes what is needed for any class to work as a key of NSDictionary or NSMutableDictionary. The only thing that is really required is that your class adopt the NSCopying protocol.  That’s because every key is copied before being added to the dictionary.  I mention why this design decision was probably made below. […]

UIScrollView bug

This post describes a bug in UIScrollView that occurs when you programmatically set the contentOffset with animation. Below is code to reproduce the bug; I’ve confirmed it’s in iPhone OS 3.2 but it may be in other versions as well. If you make a call to [scrollView setContentOffset:offset1 animated:YES]; and later make a call to […]