Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-14-2011, 03:59 PM   #1 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Exclamation Slider to change variable

How could i connect a UISlider to a specific variable where the user could use the slider to change the value of the variable and display the number? Some code would be great!
Mr.Abe90 is offline   Reply With Quote
Old 01-14-2011, 04:08 PM   #2 (permalink)
Knows SQL
 
iisword's Avatar
 
Join Date: Oct 2009
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 529
iisword is on a distinguished road
Default

I'm assuming your doing this programmatically

Code:
slider.minimumValue = 0;
slider.maximumValue = 100;
float f = slider.value;
[label setText:[NSString stringWithFormat:@"%f.2"];//I do .2 so the float will go to second decimal place
note that if you want an int you need to do

Code:
int i = (int) slider.value;
__________________

Last edited by iisword; 01-14-2011 at 04:13 PM.
iisword is offline   Reply With Quote
Old 01-16-2011, 04:46 PM   #3 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Question Slider to change variable

How could i connect a UISlider to a specific variable where the user could use the slider to change the value of the variable? Here is some code other people have given me and none of it works.
Code:
float f = slider.value;
and
Code:
-(IBAction)yourMethod:(id)sender {
	UISlider *slider = (UISlider *)sender;
	[self setYourFloat:[slider value]];
If someone could please give me some WORKING code that would be great.
Mr.Abe90 is offline   Reply With Quote
Old 01-16-2011, 04:52 PM   #4 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

You already asked the same question in this thread: http://www.iphonedevsdk.com/forum/ip...-variable.html
There is no need to create multiple threads for the same question.
baja_yu is offline   Reply With Quote
Old 01-16-2011, 04:54 PM   #5 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
You already asked the same question in this thread: http://www.iphonedevsdk.com/forum/ip...-variable.html
There is no need to create multiple threads for the same question.
yes but as I said that code didn't work
Mr.Abe90 is offline   Reply With Quote
Old 01-16-2011, 05:14 PM   #6 (permalink)
Registered Member
 
Mr.Abe90's Avatar
 
Join Date: Sep 2010
Posts: 45
Mr.Abe90 is on a distinguished road
Default

Quote:
Originally Posted by iisword View Post
I'm assuming your doing this programmatically

Code:
slider.minimumValue = 0;
slider.maximumValue = 100;
float f = slider.value;
[label setText:[NSString stringWithFormat:@"%f.2"];//I do .2 so the float will go to second decimal place
note that if you want an int you need to do

Code:
int i = (int) slider.value;
It didn't work.
And i know how to do the min/max and display the value, I just need the code for changing the variable with the slider.
Mr.Abe90 is offline   Reply With Quote
Old 01-16-2011, 05:52 PM   #7 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

You have to explain more than that. Saying "it didn't work" tells us nothing. What is your exact code, what happens when you run it, what did you expect to happen, do you get errors, if you do, which errors and on which lines, if nothing happens did you try putting a breakpoint and seeing if the code is being executed at all...
baja_yu is offline   Reply With Quote
Reply

Bookmarks

Tags
slide, slider, variable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 365
10 members and 355 guests
7twenty7, blueorb, dre, iAppDeveloper, iGamesDev, Mah6447, Morrisone, mottdog, sacha1996, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0