I have recently begun to learn to develop applications for the iPhone. This means I’m getting my head back into Objective-C (where it’s not been for several years – ever since I stopped writing WebObjects code) and learning all the cocoa frameworks and specialized SDK for the iPhone.
For a project I’m working on, we have decided to use what is known as the UIPickerView widget to allow the user to select something on the screen. You can think of the UIPickerView as something loosely akin to what you may find on a slot machine. Here’s a screenshot of a little demo app I wrote:
Now, Apple have (in my opinion) crippled this selector a bit, in that they force it to a certain height and width. They do allow you to place the upper left corner wherever you like, but you’re stuck with the size that the framework provides for you.
So, last week (before leaving town for almost a week) I spent a few hours learning how to hook up one of these pickers. It’s a little tricky in that you have to create a delegate that must implement a few required methods. See the SDK documentation for UIPickerView for details.
Er, wait. No. Don’t.
You see, the API for this little bugger keeps changing. In major ways.
Last week when I was playing with this, you had to create a delegate that had 2 required methods to implement, and 3 optional ones. This week, there are 5 optional methods, with the 2 required methods moved to a new UIPickerViewDataProvider that you *also* have to implement.
There are no docs for UIPickerViewDataProvider yet.
I expect that Apple will get the docs in sync quickly with the actual API that is available, however, note that when Apple says the following in their API documentation, they really mean it:
“Important: This is a preliminary document for an API or technology in development. … This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation…”
Caveat emptor.
Leave a Reply