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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:20:46+00:00 2026-06-12T08:20:46+00:00

I have been searching and trying to work this out for a few hours.

  • 0

I have been searching and trying to work this out for a few hours. I know that I’m making a very simple mistake, I just don’t know what it is!

I am trying to get the text that’s entered into two different UITextFields and put them into a table of another TableViewController.

My NSLog is returning that my addGuestViewController is receiving the text input, but not transferring it into my guestlistViewController.

guestlistViewController.h

@interface guestlistViewController : UITableViewController {
    NSString *firstnameInput;
    NSString *lastnameInput;
}
@property (nonatomic, retain) NSString *firstnameInput;
@property (nonatomic, retain) NSString *lastnameInput;

@end

guestlistViewController.m

@synthesize firstnameInput;
@synthesize lastnameInput;
NSString *fullname = [NSString stringWithFormat:@"%@ %@", firstnameInput, lastnameInput];

NSArray *array = [[NSArray alloc] initWithObjects: fullname, nil];
NSLog(@"Their name is: "%@", fullname);

addGuestListViewController.h

@interface addGuestViewController : UITableViewController

@property NSString *firstnameInput;
@property NSString *lastnameInput;

@end

addGuestListViewController.m

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    firstnameInput = firstname.text;
    lastnameInput = lastname.text;

    if (textField == firstname) {
        [textField resignFirstResponder];
        [lastname becomeFirstResponder];
    } else if (textField == lastname) {
        [textField resignFirstResponder];
        [self performSegueWithIdentifier:@"done" sender:self];
        NSLog(@"Their name is: %@, %@", firstnameInput, lastnameInput);
    }
    return YES;
}

If someone could inform me on what I’m doing wrong, it’d be a huge help as I’m fairly new to programming in Objective-C.

EDIT:

I was thinking that because I have my segue pointing to a navigation controller, it could be causing a problem, but not sure.

  • 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-12T08:20:47+00:00Added an answer on June 12, 2026 at 8:20 am

    You’re not setting the properties, firstnameInput and lastnameInput of your guestlistViewController — In the textFieldShouldReturn: method, you’re assigning values from the text fields to the addGuestListViewController’s properties, not to the ones in guestlistViewController. You need to implement the method prepareForSegue:sender:, and in that method you get a reference to guestlistViewController with segue.destinationViewController. With that reference, you can set the values of the properties in that view controller. Something like this:

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
         [(guestlistViewController *)[[(UINavigationController *)segue.destinationViewController viewControllers] lastObject] setFirstnameInput:firstnameInput];
         [(guestlistViewController *)[[(UINavigationController *)segue.destinationViewController viewControllers] lastObject] setLastnameInput:lastnameInput];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been searching around trying to work this out for a while now. There's
I've been searching and trying to get this to work for the past few
I have been searching for an answer and trying out stuff for days now
I have been searching for the past through days, trying to figure out how
I have been searching for a command that will return files from the current
I have been searching for a solution to this and so far found nothing
I have been having trouble searching through a MySQL table, trying to find entries
I have been searching through SO for the last few days and have found
I know this is a very beginner question, but I've been struggling to figure
I've been searching all over for tips on this and have not really had

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.