displayingg custom objects from array on the value of slider
<p>i am developing a weather application... the basic idea of which is 
getting the forecast from a service.... which i did.... adding the custom weather 
objects to an array.... which i did... <code>FYI the weather objects contains about 12 poperties....</code> </p>

<p>now i have a slider and i want to display <code>mean or average of two temperature properties from weather objects that i get from an array on the value of slider...</code>  and i should tell you that the array contains about 40 objects and the slider is of 1440mins max value.... which makes about 12hrs </p>

<p>now the main problem is that how cain i perform this in a loop and get the objects from array dynamicaly cause <code>i dont want to hardcode the indexes of the array</code></p>

<p>i can get objects like and also want things like this...</p>

<pre><code>if(sliderValue&lt;180)
weather = [array objectAtIndex:0];

if(sliderValue&lt;360)
weather = [array objectAtIndex:1];

if(sliderValue&lt;540)
weather = [array objectAtIndex:2];

if(sliderValue&lt;720)
weather = [array objectAtIndex:3];

if(sliderValue&lt;810)
weather = [array objectAtIndex:4];


and so on up to slidervalue == 1440
</code></pre>

<p>i already made all the if else for every condition which makes 144 if else(from value == 10 to value == 1440) so i think that is not efficient....</p>

<p>simple is that i have a <code>UISlider and whose max value is 1440</code> and on every 10th interval means <code>after every 10 points i want to display average of two values</code>.... the values are stored in custom objects which are stored in an <code>NSArray</code>. And the custom objects are created from <code>XML</code> using a web service api so i dun know exactly how much objects will the XML return so for that purpose i dont want to hardcode the indexes of the array and take objects dynamically from the array because sometime the array may not contain the object on the index and the app would crash... thats the whole story... hope u get me....</p>

<pre><code>main point is displaying and calculating average of two values after every 10 points of the slider value... and as i mentioned the conditions earlier if the value increases by 180 the index increases and next object is fetched from the array....
</code></pre>
