A UIPickerView with labels

I recently needed a picker view with labels (like the one in the timer tab in the Clock app) to select minutes and seconds for a time interval. So I made the following subclass of UIPickerView:

#import

/**
A picker view with labels under the selection indicator.
Similar to the one in the timer tab in the Clock app.
NB: has only been tested with less than four wheels.
*/
@interface LabeledPickerView : UIPickerView {
NSMutableDictionary *labels;
}

/** Adds the label for the given component. */
- (void) addLabel:(NSString *)labeltext forComponent:(NSUInteger)component;

@end

Read More

Naming things

As is evident from the name of this blog (and the name of my open source project mySettings),  I’m not particularly good at naming things. So if anyone can come up with a better name for this blog, then please let me know. I only called it NotTooBad Blog because it fits in with the name of my website, NotTooBad Software (a name I am satisfied with).

mySettings: A Settings API for the iPhone

NB: Unfortunately I am not able to do any more development on this or any other projects. I am hoping that someone else will take over the project and update it. There is also this similar project.

A lot of iPhone apps have their own settings views similar to the ones in the Settings App on the iPhone home screen. But to my surprise I couldn’t find any general API for it. So I made my own and published it here. It uses a plist configuration file like the one used by the Settings App, with some added options (and some removed ones, but they will hopefully be implemented in the near future).

In a nutshell it takes a plist like this:

plist

and turns it into this:

iPhone

Features

  • Text fields, on/off switch button, integers and time intervals (with maximum/minimum values and custom format string for the integers).
    More options are needed, obviously, like dates and select lists. Feel free to help out if there are other options you would like to see implemented.
  • Titles can be indented.
  • By default the settings themselves are stored in the standard user defaults object ([NSUserDefaults standardUserDefaults]), but you can use any object that supports key-value coding. This enables you to use your model classes directly in the settings view.
  • And if you don’t find blue pyjama stripes exciting, you can of course change the table view background.

And that’s it for the time being. A work in progress, obviously. I would also like to see support for custom table cells and dynamically filling a section with the contents of an array or a dictionary. And localisation. And sliders. And customising fonts and colours. And lots more cool stuff. So if you want to check it out, follow these instructions. And if you make any changes please let me know so I can merge them back into the repository.

Welcome

Hi, and welcome to my blog. It will almost exclusively be about programming (iPhone-programming to be specific), so if that’s not your particular cup of tea then you’re probably better off with this one. I’m aiming for two or three posts a month, so hopefully I won’t be contributing too much to the unread count of your RSS reader.

PS: I know I’m using the default theme for WordPress, but I really like it and I’ve only seen one other blog using it. If I should happen to come across a better one I might change, but for now I’m happy with this one.