views:

749

answers:

2

I have a custom UITableViewCell that contains a UISlider control and a UILabel which shows the current text value for the slider position. I want to update the label as the slider knob is dragged. Here are the basic elements.

cellForRowAtIndexPath: This routine takes data and updates the slider value and the label associated with it.

sliderValueChanged: This routine reads the slider value updates the data. It then calls [table reloadData] so the label gets updated.

Problem: Somehow the reloadData is interrupting the flow of updates. If I substitute NSLog instead of reloadData I get a nice stream of updates showing the value of the slider. In an attempt to prevent looping I put in tests to not set the slider value or call reloadData unless the value was different. That didn't fix things.

Any help would be greatly appreciated!

A: 

Stuff like this happened to me. Go to build settings and look for a compiler flagged called "Enable floating point library calls". Make sure it's disabled. See if that helps you.

That flag is disabled in my code and I'm still having the issue.
Voripteth
+2  A: 

The problem is being caused by the [table reloadData] which appears to be creating a new Cell object so updates the same slider aren't working. The correct implementation was to get the referenced cell inside the sliderValueChanged routine and set the label from there. Set a tag to the slider to indicate the row and then call the method to get the cell with the index path.

Voripteth
would love to see some code on this, I'm working on doing the same thing if i get it figured I'll post it.
nickthedude