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 06-16-2010, 12:04 PM   #1 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Question Reverse UISlider Values Min / Max

Is there a way to reverse the UISlider values? The default is minimum on the left, and maximum on the right. Which I find curious as the iBooks brightness slider behaves the opposite.

I tried reversing the Minimum and Maximum integers I entered into Interface Builder Value fields, but it did not like this.

Suggestions appreciated.
DenVog is offline   Reply With Quote
Old 06-16-2010, 12:08 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

You're probly gonna have to go with a custom UISlider.
smithdale87 is offline   Reply With Quote
Old 06-16-2010, 12:34 PM   #3 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Default

Quote:
Originally Posted by smithdale87 View Post
You're probly gonna have to go with a custom UISlider.
I have used custom UISlider, but I don't know how you reverse the values. The minimum value seems to always be applied to the far left position and the maximum value to the far right. Even if I set the value programmatically.
Code:
mySlider.minimumValue = 0;
mySlider.maximumValue = 1;
Am I misunderstanding your suggestion?
DenVog is offline   Reply With Quote
Old 06-16-2010, 12:38 PM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Even more customization.. override the drawing methods or the layoutSubviews, or just completely create a custom slider from scratch
smithdale87 is offline   Reply With Quote
Old 08-31-2010, 03:23 PM   #5 (permalink)
Banned
 
Join Date: Jul 2009
Posts: 576
Not_Appy_At_All is on a distinguished road
Default

Quote:
Originally Posted by DenVog View Post
Is there a way to reverse the UISlider values? The default is minimum on the left, and maximum on the right. Which I find curious as the iBooks brightness slider behaves the opposite.

I tried reversing the Minimum and Maximum integers I entered into Interface Builder Value fields, but it did not like this.

Suggestions appreciated.

I have a simple solution, although I am sure you have already figured this out by now, due to the age of this thread.

I needed a vertical slider, so used the following command to rotate it.

yourSlider.transform = CGAffineTransformRotate(yourSlider.transform, 270.0/180*M_PI);

I then needed the exact same thing as you...so rotated it another 90 degrees placing it in an upside down position. Slider is symetrical, so it looks exactly the same in both positions. But the min and max values are now the opposite.

Command is...

yourSlider.transform = CGAffineTransformRotate(yourSlider.transform, 180.0/180*M_PI);



Hope that helps somebody.
Not_Appy_At_All is offline   Reply With Quote
Old 08-31-2010, 03:31 PM   #6 (permalink)
Elegance is Infinite
iPhone Dev SDK Supporter
 
TapTouchClick's Avatar
 
Join Date: Jan 2010
Location: Bay Area, CA
Posts: 677
TapTouchClick is on a distinguished road
Send a message via AIM to TapTouchClick Send a message via Skype™ to TapTouchClick
Default

You could also just do a math equation. Slider Maximum - Slider Current = slider going from 1 to 0.
__________________
Our website
TapTouchClick is offline   Reply With Quote
Old 08-31-2010, 03:36 PM   #7 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

The iBooks brightness slider works as every other slider, the minimum brightness is on the left, and maximum on the right, where's the confusion?
harrytheshark is offline   Reply With Quote
Old 08-31-2010, 03:45 PM   #8 (permalink)
Elegance is Infinite
iPhone Dev SDK Supporter
 
TapTouchClick's Avatar
 
Join Date: Jan 2010
Location: Bay Area, CA
Posts: 677
TapTouchClick is on a distinguished road
Send a message via AIM to TapTouchClick Send a message via Skype™ to TapTouchClick
Default

your also bound to be rejected if you do the opposite. Apple doesn't like confusion.
__________________
Our website
TapTouchClick is offline   Reply With Quote
Old 08-31-2010, 04:02 PM   #9 (permalink)
Banned
 
Join Date: Jul 2009
Posts: 576
Not_Appy_At_All is on a distinguished road
Default

Quote:
Originally Posted by TapTouchClick View Post
You could also just do a math equation. Slider Maximum - Slider Current = slider going from 1 to 0.

Ironically, I was just going to amend my post with your above solution....as an alternate way to do it.

I needed the slider to go from 1.5 secs to 0.5 secs for an animation.

So...

2.0 - 0.5 = 1.5

and

2.0 - 1.5 = 0.5

Your way is the better way, as it does not require flipping the slider 180 degrees.

Your point re Apple is well taken.
Not_Appy_At_All is offline   Reply With Quote
Old 08-31-2010, 09:12 PM   #10 (permalink)
Use [code] tags please
 
Join Date: Jun 2009
Location: Jacksonville, FL
Posts: 410
timle8n1 is on a distinguished road
Default

Quote:
Originally Posted by harrytheshark View Post
The iBooks brightness slider works as every other slider, the minimum brightness is on the left, and maximum on the right, where's the confusion?
Maximum darkness on the left???
timle8n1 is offline   Reply With Quote
Old 09-01-2010, 03:27 AM   #11 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

Well sure, but the slider is a measure of brightness, not darkness.
harrytheshark is offline   Reply With Quote
Old 09-01-2010, 06:27 AM   #12 (permalink)
Use [code] tags please
 
Join Date: Jun 2009
Location: Jacksonville, FL
Posts: 410
timle8n1 is on a distinguished road
Default

Quote:
Originally Posted by harrytheshark View Post
Well sure, but the slider is a measure of brightness, not darkness.
It's called sarcasm
timle8n1 is offline   Reply With Quote
Old 09-01-2010, 06:27 AM   #13 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

You never know on this board...

This face: helps
harrytheshark is offline   Reply With Quote
Old 09-01-2010, 07:45 AM   #14 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 138
SpaceAce is on a distinguished road
Default

TapTouchClick is right in both ways: Even though min max could easily be reversed by a simply math equation this will earn you a rejection with reason "... leads to user confusion" because the user expects the UISlider value to increase when moved towards the right side.

Just curious here: Why would you want to reverse the behaviour? Is there any special reason/idea behind it?
SpaceAce is offline   Reply With Quote
Old 09-04-2010, 09:55 AM   #15 (permalink)
Banned
 
Join Date: Jul 2009
Posts: 576
Not_Appy_At_All is on a distinguished road
Default

Quote:
Originally Posted by SpaceAce View Post
TapTouchClick is right in both ways: Even though min max could easily be reversed by a simply math equation this will earn you a rejection with reason "... leads to user confusion" because the user expects the UISlider value to increase when moved towards the right side.

Just curious here: Why would you want to reverse the behaviour? Is there any special reason/idea behind it?

In my case, using the math formula actually speeds up the animation, because the time...1.5 is reduced to 0.5 secs....so the animation speeds up.

And the slider, in the users eye does exactly what it should do.

left to right slide increases the animation speed.
Not_Appy_At_All is offline   Reply With Quote
Old 09-04-2010, 11:00 AM   #16 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Cool

Quote:
Originally Posted by harrytheshark View Post
The iBooks brightness slider works as every other slider, the minimum brightness is on the left, and maximum on the right, where's the confusion?
Don't confuse the values with the intended results. If you're trying to build a UISlider where the left is the larger value, the default UISlider settings are backwards.

For example, I don't think we're allowed to control the actual brightness of device's screen directly. So some people fake it by putting a dark view on top and set it's alpha. If you use the default UISlider settings, max brightness would be alpha of 0 (slide to the left) and min brightness would be alpha of 1 (slide to the right).

If you do this, your brightness control will be reversed from the user perspective compared with iBooks. Not ideal, and the reason for my question. It does work though, and my app was not rejected.

Last edited by DenVog; 09-04-2010 at 11:04 AM.
DenVog is offline   Reply With Quote
Old 09-04-2010, 11:01 AM   #17 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Default

Quote:
Originally Posted by Not_Appy_At_All View Post
I have a simple solution, although I am sure you have already figured this out by now, due to the age of this thread.

I needed a vertical slider, so used the following command to rotate it.

yourSlider.transform = CGAffineTransformRotate(yourSlider.transform, 270.0/180*M_PI);

I then needed the exact same thing as you...so rotated it another 90 degrees placing it in an upside down position. Slider is symetrical, so it looks exactly the same in both positions. But the min and max values are now the opposite.

Command is...

yourSlider.transform = CGAffineTransformRotate(yourSlider.transform, 180.0/180*M_PI);



Hope that helps somebody.
Thanks for taking time to share your suggestion.
DenVog is offline   Reply With Quote
Old 09-04-2010, 11:42 AM   #18 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

We're not allowed to control the brightness, but Apple are

Glad you worked it out though
harrytheshark is offline   Reply With Quote
Reply

Bookmarks

Tags
uislider

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: 323
8 members and 315 guests
Absentia, Domele, fiftysixty, givensur, heshiming, michaelhansen, PixelInteractive, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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