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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:51:46+00:00 2026-06-09T02:51:46+00:00

This is mainly a delegation question because I’m still learning and don’t get it.

  • 0

This is mainly a delegation question because I’m still learning and don’t get it. I don’t know how to go about creating the delegate I need.

I know similar questions have been asked but the solutions don’t help me out. How can I switch the text of a label on View 1 with the contents of a UITextField from View 2?

Thanks!

  • 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-09T02:51:47+00:00Added an answer on June 9, 2026 at 2:51 am

    In this code snippet, ChildViewController is your View2 and ParentViewController is your View1.

    In your ChildViewController.h file:

    @protocol ChildViewControllerDelegate <NSObject>
    - (void)parentMethodThatChildCanCall:(NSString *)string;  //pass back the string value from your textfield
    @end
    
    @interface ChildViewController : UIViewController 
    {
        @property (weak, nonatomic) IBOutlet UITextField *myTextField;
    }
    @property (assign) id <ChildViewControllerDelegate> delegate;
    

    In your ChildViewController.m file:

    @implementation ChildViewController
    @synthesize delegate;
    
    // Some where in your ChildViewController.m file
    // to call parent method:
    //  [self.delegate parentMethodThatChildCanCall:myTextField.text];
    

    In ParentViewController.h file:

    @interface parentViewController <ChildViewControllerDelegate>
    {
        @property (strong, nonatomic) IBOutlet UILabel *myLabel;
    }
    

    In ParentViewController.m file:

    //after create instant of your ChildViewController
    
    childViewController.delegate = self;
    
    - (void) parentMethodThatChildCanCall:(NSString *)string
    {
      // assign your passed back textfield value to your label here
        myLabel.text = string;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is mainly a delegation question because I'm still learning and don't get it.
Mainly this is a question about how to get a similar behaviour as java
This is mainly a theoretical question i.e I don't have any need for a
This question is mainly about protecting the content inside my iOS app. I intend
This is mainly a Delphi syntax related question. I need to set a parameter
This is mainly in regards to my question here , but I don't understand
I am having trouble with this setup mainly because I am not sure what
This question is mainly to verify my current idea. I have a series of
This question is mainly aimed at shared libraries (.so files) compiled for Linux platforms.
I'm mainly asking this to professionals who know the playing field of professional developing.

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.