Wednesday, March 23, 2011

Store a number in an integer string and recall it in a later action

I'm currently trying to get a UISlider to work.

I'm trying to set the strings value as 8 to start off with on view load.

Then when the slider changes value I want the string to update with that number, and then later on I can use the value in the string for a setDuration:## later on in another action.

Any ideas?

From stackoverflow
  • To update the string you just get the value and do:

    NSString *myString = [NSString stringWithFormat:@"%f", [slider value]];
    

    To get the string value back as a float you just do:

    float myValue = [myString floatValue];
    
  • I ended up using CAFloat..

0 comments:

Post a Comment