Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:40:18+00:00 2026-05-15T04:40:18+00:00

Can anyone point me in the right direction regarding sliders, the version below was

  • 0

Can anyone point me in the right direction regarding sliders, the version below was my first attempt (the range is 0.0 – 100.0) The results I get are not right.

// Version 1.0
-(IBAction)sliderMoved:(id)sender {
    NSLog(@"SliderValue ... %d",(int)[sender value]);
}

// OUTPUT:
// [1845:207] SliderMoved ... -1.991753
// [1845:207] SliderMoved ... 0.000000
// [1845:207] SliderMoved ... 0.000000
// [1845:207] SliderMoved ... 32768.000435

With the version below I get the values I expect, what am I missing in version_001?

// Version 2.0
-(IBAction)sliderMoved:(UISlider *)sender {
    NSLog(@"SliderValue ... %d",(int)[sender value]);
}

// OUTPUT:
// [1914:207] SliderMoved ... 1
// [1914:207] SliderMoved ... 2
// [1914:207] SliderMoved ... 3
// [1914:207] SliderMoved ... 4

EDIT_001:

Adding UISlider *slider = (UISlider *)sender; as Substance G points out does indeed work. I understand that using sender is the convention, but it seems to me in this case that not only is the convention less clear its also more complicated and more code. It would seem sensible IMO to statically type the method to (UISlider *) as in version 2.0. Is there a situation I am overlooking in the slider IBAction method where using (UISlider *) would not work?

cheers Gary

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:40:19+00:00Added an answer on May 15, 2026 at 4:40 am

    Try:

    -(IBAction)sliderMoved:(id)sender {
        UISlider *slider = (UISlider *)sender;
        NSLog(@"SliderValue ... %d",(int)[slider value]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone point me in the right direction on this. From reading the FAQs
Can anyone point into the right direction here. I want to respond when my
Can anyone point me in the right direction of some facial recognition libraries &
Can anyone point me in the right direction how to configure Visual Studio 2005
Can anyone point me in the right direction as to what is all involved
Can anyone point me to a good resource (or throw me a clue) to
Can anyone point me to a good introduction to coding against the paypal API?
Can anyone point me to a tutorial on the best way to open a
Can anyone point to libraries that can be used for Printing from Compact .Net
Can anyone point me to a library for 2D game physics, etc for programming

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.