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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:30:46+00:00 2026-06-14T19:30:46+00:00

I have multiple buttons in ViewA. When a button is clicked, it is redirected

  • 0

I have multiple buttons in ViewA. When a button is clicked, it is redirected to ViewB. In ViewB, the user does some interactions, and then clicks the back button when he is done. How do I run a method and pass in a parameter from ViewB into ViewA and then continue working in ViewA?

Using the back button is strongly required, but I am keen to learn if there are other ways.

My idea was to get the ViewA from the stack, and when I am done with ViewB, just call upon it and redirect, but I couldn’t figure out how to do it.

Thank you.

  • 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-14T19:30:47+00:00Added an answer on June 14, 2026 at 7:30 pm

    You want to define a delegate in ViewB and implement it in ViewA. At the appropriate time (e.g., when the back button is tapped) ViewB call the delegate method, passing the value as a parameter.

    Something like this:

    ViewB.h

    // Define a delegate protocol allowing 
    @protocol ViewBDelegate
    
    // Method of delegate called when user taps the 'back' button
    -(void) backButtonSelected:(id) object;
    
    @end
    
    
    @interface ViewB : UIViewController
    
    // property to hold a reference to the delegate
    @property (weak)id<ViewBDelegate> delegate;
    
    -(IBAction)backButtonSelected:(id)sender;
    
    @end
    

    ViewB.m:

    @implementation ViewB
    
    ...
    
    -(IBAction)backButtonSelected:(id)sender{
        NSObject *someObjectOrValue = nil;
    
        // Invoke the delegates backButtonSelected method, 
        // passing the value/object of interest
        [self.delegate backButtonSelected:someObjectOrValue];
    }
    
    @end
    

    ViewA.h:

    #import "ViewB.h"
    
    
    //  The identifier in pointy brackets (e.g., <>) defines the protocol(s)
    // ViewA implements
    @interface ViewA : UIViewController <ViewBDelegate>
    
    ...
    
    -(IBAction)someButtonSelected:(id)sender;
    
    @end
    

    ViewA.m:

    -(IBAction) someButtonSelected:id
    @implementation ViewA

    ...
    
    // Called when user taps some button on ViewA (assumes it is "hooked up" 
    // in the storyboard or IB
    -(IBAction)someButtonSelected:(id)sender{
    
        // Create/get reference to ViewB.  May be an alloc/init, getting from storyboard, etc.
        ViewB *viewB = // ViewB initialization code
    
        // Set `ViewB`'s delegate property to this instance of `ViewA`
        viewB.delegate = self;
        ...
    }
    
    // The delegate method (defined in ViewB.h) this class implements
    -(void)backButtonSelected:(id)object{
        // Use the object pass as appropriate
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple pages branching of a title page, and when a back button
I have multiple buttons that gets created in a table which all look like
I have multiple buttons on a page and I want to simulate a click
How can I have multiple buttons and multiple listeners doing various operations in java
I have a form made in JSP, here I have multiple buttons - Approve,
I have multiple twitter share buttons on a page, I want to identify which
In my WP 7.1 app I have a page with multiple buttons. I noticed
Multiple sites have buttons where you can tweet, digg, etc. On this page you'll
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
i have a button that plays a sound. When i push the button multiple

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.