views:

644

answers:

2

Hey hope someone can help as I am at my wits end with this!?

I have a UISlider. I would like it to move as progress of a task takes place (playing music).

Im setting its value as the continues events happen. (progress through the track)

-(void)updateSlider:(float)value {
    NSLog(@" %f ",value);
    [timeIndexSlider setValue: value animated:YES];
}

Logs state that the float value is fine..

but its just doesn't move and I get the no autorelease pool - just leaking message, that you would get from a thread without one in the console. There is no thread involved on my part.

Is there a problem updating a UISlider this often?

Is there another way of controlling the sliders movement?

Cheers

A: 

Are you retaining a reference to the UISlider? If not, you could be calling -setValue:animated: on a nil reference. Objective-C will allow this, without actually performing the method.

This could potentially explain why you are getting the correct float value passed into the function, but are not getting any updates...

Set a breakpoint as suggested, and make sure that the UISlider reference is not nil.

If not, try posting some code so that we can take a look.

Let us know how it goes,

Tom

thauburger
No the slider is there... and I have addedNSLog(@" %f",timeIndexSlider.value);after the call and the value is correct!... just not visually changing the display.
Chris
A: 

I think you're getting updates on another thread and then calling into UIKit on that thread.

Try doing a performSelectorOnMainThread with a new method that does the update (maybe taking an NSNumber object).

Andrew Pouliot
You are Awesome!
Chris
Still leaks the object being passed into the perform Selector tho
Chris