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 7987891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:16:40+00:00 2026-06-04T12:16:40+00:00

So i have this slider in my view and that has a max of

  • 0

So i have this slider in my view and that has a max of 13 and a min of 1. Dependent on how you move the slider the number changes and can be shown on a label that shows the current number the slider is on.

I want to be able to change the int from the slider into a string; so if the progress of the slider is 13 i want the label to read “A+”, 12 with “A” 11 with “A-” and so on.

Without having to make 13 “if” statements because i have more than one slider, is there a way to make a method that checks the progress of the slider then converts the number to the desired letter grade?

here is my code for one of the sliders

-(IBAction)sliderChanged:(id)sender{
    UISlider *slider = (UISlider *)sender;
    int progress = (int)roundf(slider.value);
    c1Grade.text = [NSString stringWithFormat:@"%d",progress];
}
// c1Grade is the label next to the slider showing the progress
  • 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-06-04T12:16:41+00:00Added an answer on June 4, 2026 at 12:16 pm

    Make an array of strings, and place the description at the index the description represents: @"A+" would be at index 13, "A" at index 12, and so on.

    NSArray *gradeDescriptions = [NSArray arrayWithObjects: @"", @"F", @"D-", @"D", @"D+", @"C-", @"C", @"C+", @"B-", @"B", @"B+", @"A-", @"A", @"A+", nil];
    NSString *descr = [gradeDescriptions objectAt:sliderPosition];
    

    Since gradeDescriptions array never changes, you can initialize it once, and store in a static variable or an ivar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I have this complicated slider that utilizes tons of animation. I'm trying to find
I have this menu structure that is used to navigate through content slider panels.
I have a modal view that has a UIToolbar at the top . In
I have a view-based NSTableView that usually has one column in it. However, at
I have view a that has a table cell and a save button. If
I have this test slider http://jsfiddle.net/dUyLY/2/ In Chrome it works nice, but in firefox
I have this markup: <div id=slider1> <div class=ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all> <a style=left:
I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
I want to make a GUI have a slider, this slider's value will be

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.