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

  • SEARCH
  • Home
  • 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 6900547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:33:34+00:00 2026-05-27T07:33:34+00:00

There are 24 buttons that their labels change from a function driven by a

  • 0

There are 24 buttons that their labels change from a function driven by a UISegmentedControl that has 7 segments. There is also a UIPickerView with 9 different objects. These two dynamically change the labels of the buttons. Then, when a button is pressed i have to know the UIPickerView object that is selected, the UISegmentedControl selection and which button is this.

My function that receives and executes is this:

- (int)ButtonPlayController:(int)buttonPressed {

   NSString *button = [NSString stringWithFormat:@"%@%i", @"button", buttonPressed];

   if (button.titleLabel.text == @"1C") {

       [self Play1C];

   }

  else if .....

}

The function receives a number (the button number) and combines the string name to create the UIButton name, e.g. if the function receives number 8 then the UIButton name is button8 (i already have on my .h file: IBOutlet UIButton *button8;)

I remember these work on PHP but what about Object C? What do i have to change for this to work?

  • 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-27T07:33:34+00:00Added an answer on May 27, 2026 at 7:33 am

    Looks like there some pointers for you in the comments, but I’m wondering why you are implementing your target-action this way? Maybe there is a part of your program I don’t understand but why not just pass the button as the argument to the receiver of the action:

    - (IBAction)doStuffWithButton:(id)sender
    {
        if ( sender.tag == 1 )
        {
            [self actOnOne];
        }
        else if ( sender.tag == 2 )
        {
            ....
        }
    }
    

    Like I say, this doesn’t answer your original question, but maybe a different design pattern would make things easier?

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

Sidebar

Related Questions

I could only find the function confirm() that gives OK/Cancel buttons. Is there any
I am setting up a UINavigationBar with 2 buttons that change their title when
I'm working on a Wicket-based web application. In the application there are buttons that
In my app there is requirement that..I have 6 buttons in a nib, when
I'm making an input that looks like this: There are many different ways to
I've a dgv on my main form, there is a button that opens up
Is there any button or shortcut that can make publish job instead of clicking
Is there an event that is fired when the user presses the close button?
In my application I have some link buttons there but when I right click
there are some buttons on the top of the winform, and when I click

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.