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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:35:49+00:00 2026-05-26T18:35:49+00:00

I am creating a calculator view that uses sliders to set textbox values. Each

  • 0

I am creating a calculator view that uses sliders to set textbox values. Each textbox has a slider that corresponds to it. The code for updating textbox values is as follows:

- (void) updateAlphaTextField:(id)sender 
{
    int value = [alphaSlider value];

    NSString *stringValue = [NSString stringWithFormat:@"%d",value];

    [alphaTextField setText:stringValue];    
}

However I have about 20 textboxes (and 20 corresponding sliders) that I would like to demonstrate this behavior and I don’t want to write 20 of these update functions.

Is there a function that I can write that could watch all the sliders and update a corresponding textbox with the right value? If so, how do I make my IB connections to get it to work? (The above function required 1 IB connection to be made)

Or even better is there a Cocoa Touch function that would allow me to do this easily?

  • 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-26T18:35:50+00:00Added an answer on May 26, 2026 at 6:35 pm

    Put tags in your UITextFields and UISliders. For instance: UITextField 1, would have tag 1 and the UISlider 1, would also have tag 1. Then, create an IBOutlet collection with all your UITextFields. You can use this to help you out:

    http://www.bobmccune.com/2011/01/31/using-ios-4s-iboutletcollection/

    In your function do this:

    - (void) updateAlphaTextField:(id)sender 
    {
        int value = [alphaSlider value];
    
        NSString *stringValue = [NSString stringWithFormat:@"%d",value];
    
        UISlider *senderSlider = (UISlider*)sender;
    
        for(UITextField *textField in textFieldCollection){
           if(textField.tag==senderSlider.tag){
               [textField setText:stringValue];   
           }
        }
    

    }

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

Sidebar

Related Questions

I have a small calculator that I am creating in C# (Sharp Develop). The
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
What I'm doing: I'm creating a simple calculator in Java, that reads a string
I'm creating a lua script that should run on the TI-Nspire calculator. The problem
I am creating a graphing calculator in Java as a project for my programming
basically i'm creating a tariff calculator for a utility company in my country, based
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
Simple question: I am creating an iOS app and the view controller calculates some
I am creating a view controller programmatically which is a UITabBarDelegate and contains a
I am creating a calculator app and this is my first ios app, so

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.