Why doesn't setting the value property of this UISlider update its position?


@property (nonatomic, strong) IBOutlet UISlider *slider;


@synthesize slider;

- (void)viewDidLoad
    [super viewDidLoad];

    currentValue = 50;
    self.slider.value = currentValue;

    // Do any additional setup after loading the view, typically from a nib.


The UISlider in my interface is connected to the slider property.


The slider sits all the way to the right at value 100 when it is supposed to be in the middle. An action I set up confirms the value of currentValue is 50. If currentValue is 50 and slider.value is set to 50, why doesn't the position reflect this?

P.S. I tried [slider setNeedsDisplay] and it did not affect this behavior.

Update: thanks for the quick answers! What a silly thing to do. I print out currentValue as an int elsewhere so I am now setting slider.value with this code:

self.slider.value = (float) currentValue/100;


currentValue = 50;

The slider's range is not 0...100 but 0...1. You have to write either

currentValue = 0.5;

or change the range of the slider:

self.slider.maximumValue = 100;

Need Your Help

Hibernate OneToMany relationship mapping clarification

java hibernate

I have configured the OneToMany mappings for my tables.So when inserting values to the fisrt table on second time it gives me an error Cannot insert duplicate key row in object. Here is my tables.

Count the no. of non empty nodeset in XSLT 1.0

xslt xpath sharepoint-2010 xslt-1.0

There are 24 rows returned by my dataview webpart. There's a column called NoExperience which has a number type. For some rows, it has value for NoExperience and some rows don't contain value for