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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:21:56+00:00 2026-05-21T11:21:56+00:00

So in my iPhone app I’m building, I have two buttons that are going

  • 0

So in my iPhone app I’m building, I have two buttons that are going to be designated for “Choice 1” and “Choice 2” for the users to select their date and time (for ex. to schedule an appointment).

Choice 1 has an ActionSheet to display the date, and is set to where when the user taps “Selected”, it automatically goes to the other method I have which displays two times that are programmed in (As NSArray classes).

What my question is, I want to keep those two methods, but use a method called “button1Clicked” calling both, and do the same for “button2Clicked”. Any ideas? I’ll be more than willing to supply code that I have existing. Thanks!

I couldn’t find this already answered but if someone knows if this is indeed answered on the site here can you supply a link? That would be appreciated!

Go easy please, I’m still a beginner 🙂

  • 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-21T11:21:56+00:00Added an answer on May 21, 2026 at 11:21 am

    Can you clarify your question. Are you asking how to write a method which contains calls to other methods? Or are you asking how to hook up a method to be called upon a button press? Or are you asking how to have both buttons call different methods, which methods then call the two first mentioned methods?

    For one method to handle multiple buttons:

    Approach A:

    - (IBAction)onSomeClick:(id)sender {
    
        // return if sender is not a button
        if (![sender isKindOfClass:[UIButton class]])
            return;
    
        NSString *title = [(UIButton *)sender currentTitle];
        if(title == @"Choice 1")
            // call choice 1 methods here
        else if(title == @"Choice 2"
            // call choice 2 methods here
    }
    

    Approach B:

    -(IBAction)onButtonPress:(id)sender{ 
         // if you have the logic for differentiating between 
         // the sender in the showActionSheet method, no need
         // for it here, just send the sender as the param
         [self showActionSheet:sender];         
    
         // call another method here also if appropriate
         // .. or as needed call it from within the showActionSheet method
    }
    
    // note how this does not need the IBAction return. This method doesn't need to be 
    // hooked up via Interface Builder
    -(void)showActionSheet:(id)sender{
         // here you can do your differentiation logic if you need it
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPhone app allows for users to type in their usernames and passwords so
I am building an iphone app that reads a phone number from the address
My iPhone App has custom buttons that display png-images. I like to replace the
I have an iPhone app that gets push notifications from a Windows server as
The iPhone app that I am working on requires GET calls to a 3rd
The iPhone app that I released is a wireless game controller, it translates touches
developing iphone app, I have used a UIImageview and i have set an image
An iphone app I'm working on is terminating periodically ... and I have a
My iPhone app relies on a vendor's XML feed to provide data. But that
My iPhone app will have read-only system data AND read/write user data (stored either

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.