I got this working. See the code here: http://gist.github.com/454844
There were two issues:
UIKeyboardWillShowNotification is sent before the keyboard view exists, but it you schedule your code to run on the next run loop pass, they do exist. So you don't have to bother with DidShow which is visually less pleasing.
On iOS 4 the UIKeyboard view was elsewhere in the view hierarchy.