Monday, October 26, 2009

Sliders come unstuck



I have a design issue for HeatMapper. We want to pick intervals like say, these for integers

0-1
2-3
4-5
6-8
9-12

and so on, and assign a color to each interval. The current method is to use a table view, but I thought it would be interesting to design a kind of "equalizer" like you see in iTunes or a music app.

So I set up two sliders in the nib and bound their values to instance variables in my app that have been set up with @property and @synthesize as usual. I also put in a stepper (also bound to the instance variable #1) to change the value of slider #1. (The behavior is the same if you move the slider by hand).

The idea was to bind the minimum value of slider #2 to the current value of the instance variable that is bound to slider #1. Unfortunately, it doesn't work. In fact, what it does is so weird that I can't explain it.



We start with slider #1 at 0 and slider #2 at 3.
Now move slider #1 up in steps to 1, 2, 3, 4, 5. The reported value of the variable n2 never changes. And what the slider does is just bizarre:








Here is the output:


2009-10-26 14:59:20.362 Equalizer[3291:80f] n1 = 1
2009-10-26 14:59:20.366 Equalizer[3291:80f] n2 = 3
2009-10-26 14:59:28.898 Equalizer[3291:80f] n1 = 2
2009-10-26 14:59:28.899 Equalizer[3291:80f] n2 = 3
2009-10-26 14:59:37.971 Equalizer[3291:80f] n1 = 3
2009-10-26 14:59:37.971 Equalizer[3291:80f] n2 = 3
2009-10-26 14:59:43.691 Equalizer[3291:80f] n1 = 4
2009-10-26 14:59:43.692 Equalizer[3291:80f] n2 = 3
2009-10-26 14:59:49.371 Equalizer[3291:80f] n1 = 5
2009-10-26 14:59:49.372 Equalizer[3291:80f] n2 = 3