Sunday, 25 August 2013

Dynamic Subclass for a control in a storyboard

Dynamic Subclass for a control in a storyboard References I have an app which users use to record their body measurements. Currently it uses a UIPickerView, but I want to write a custom control which looks more like a (flat, non skeu!) tape measure. Users can use either metric or imperial measurements and I want to have a different class for each representation as the current code for the UIPicker with them in together is very messy. I also want to be using interface builder if possible. So I want to build something like this: and then in IB I select the top level class. In the viewDidLoad I want to select the type of subclass to load. My question really is, am I taking the wrong direction here? As I\'ve started implementing this I\'ve realised that controls are initialised using awakeFromNib before viewDidLoad gets hit. What\'s the best way to achieve what I\'m after? Or am I over simplifying? What\'s the simplest approach that will go in the direction I want to go?

No comments:

Post a Comment