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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:04:40+00:00 2026-06-08T12:04:40+00:00

Alright, I’ll try and make this as simple as possible (I was seeming to

  • 0

Alright, I’ll try and make this as simple as possible (I was seeming to get the run around on chat.stackoveflow.com when I tried asking this question). I want to pass the text from a textfield in one viewcontroller to another viewcontroller.

Should I use a Model class and store the the textfield.text in a Model.[h/m] files and then have the second view controller access the data stored in the model?

Basically this is what I have,

ViewControllerWelcome.h

@interface ViewControllerWelcome : UIViewController { }

@property (weak, nonatomic) IBOutlet UITextField *textFieldUsername;

ViewControllerWelcome.m

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
                ViewControllerHome *home = (ViewControllerHome *)[storyboard instantiateViewControllerWithIdentifier:@"Home"];
                NSString *username = _textFieldUsername.text;
                home.lblUSERNAME.text=username;
                [self presentModalViewController:home animated:YES];

ViewControllerHome.h

@interface ViewControllerHome : UIViewController {
NSString *username;
UILabel *lblUSERNAME;
}

@property (weak, nonatomic) IBOutlet UILabel *lblUSERNAME;

ViewControllerHome.m

- (void)changeUSERNAME {

 // get username from welcome tf
ViewControllerWelcome *welcome = [[ViewControllerWelcome alloc] init];
 welcome.username = [self lblUSERNAME.text];
 // _lblUSERNAME.text = welcome._textFieldUsername.text;
 //welcome.textFieldUsername.text = _username;
 // username = welcome.textFieldUsername.text;
 NSLog(@"username = %@",username);
// welcome.textFieldUsername.text = _lblUSERNAME.text;
// NSLog(@"username = %@",welcome.textFieldUsername.text);
}    

As you can see I tried several different things, but couldn’t come up with a working solution :-l

  • 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-08T12:04:43+00:00Added an answer on June 8, 2026 at 12:04 pm

    I refined this question with another question on SO that can be found here Basically, I created a singleton to pass the data between the view controllers. I haven’t had any problems with it so far (knocks on wood).

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

Sidebar

Related Questions

Alright, I'll try and make this brief as possible. I wanted to a UIToolbar
Alright guys, this should be a very simple request. I'd like to run a
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, so I'm about 90% sure that this isn't possible, but I thought I'd
Alright, i am new to python, and simple tab creation in this language somewhat
Alright, I don't know if anyone has tried to do this yet, however. I
Alright, so I'm supposed to make a script that parses all the chat logs
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
Alright I created some custom classes for my project sourced from this tutorial ,

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.