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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:34:07+00:00 2026-05-30T06:34:07+00:00

I have an array which I’m using to populate 2 cells with text for

  • 0

I have an array which I’m using to populate 2 cells with text for now. In a different view I have a textfield, a textview etc..
How can I move the data input by user in the textfield into an array in a different controller.

here’s what I have:

- (void)viewDidLoad
{
  tabledata = [[NSArray alloc] initWithObjects:@"Franklin", @"delossantos", nil];
  [super viewDidLoad];
}

Here is the view controller of the textfields:

NewEntryController.m

#import "NewEntryViewController.h"

@implementation NewEntryViewController
@synthesize titleTextfield;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
    // Custom initialization
  }
  return self;
}

#pragma mark - View lifecycle

- (void)viewDidUnload
{
  [self setTitleTextfield:nil];
  [super viewDidUnload];
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
}

@end
  • 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-30T06:34:08+00:00Added an answer on May 30, 2026 at 6:34 am

    I guess there are two options:

    1. Separate your data in another NSObject class and make it a shared data model for both of your view controllers. Write to it when user inputs something.
    2. (Really bad option) Keep everything as is, make sure the array in the first controller is publicly accessible and simply get the data from another controller.

    Also, you declare an immutable array, you won’t be able to change it. You will have to either recreate or declare it as mutable.

    More on the first option

    In order to create a shared model, you have to create a separate class.
    Add some property to store data there, e.g.

    @property (strong, nonatomic) NSMutableArray *userStrings;

    Add @synthesize and initialise it in the init method of your new class.

    Create an instance of it and assign it to some property in both view controllers, say, to:

    @property (strong, nonatomic) NSObject *dataModel;

    After you assign it, you will be able to access it from inside your view controllers. There, when your user inputs something, you will need to update contents of your dataModel by adding, changing or removing elements in the model’s array. It will be done in some similar way:

    [self.dataModel setUserStrings:[NSMutableArray arrayWithObjects: [self.textField text], [self.textView text], nil]];
    // or
    [[self.dataModel userStrings] addObject:[self.textField text]];
    

    This way you can have a shared datasource.

    Possible easier solution

    It may be the case that you don’t need the model to be shared simultaneously between two controllers, and maybe you open second one only after user has finished inputing and you create it from your first controller.

    In that case you don’t have to create and share the model, you can just create an array based on user input and pass it in your second controller. You would create that second controller and set it’s property tableData. When your next controller appears it’d just read from that property and show the data.


    If you need more info on such approaches, I’d suggest you watch some video tutorials on using MVC approach in Objective-C. For example, Stanford’s course on iOS Programming is awesome. It is available for free in the iTunes U.

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

Sidebar

Related Questions

I have an array which contains around 50-200 hyperlinks. How can I pass this
Lets say I have an array which has n dimensions. Now in order to
i have an array which is populated in the spinner adapter. now i wanna
I have an array which can be any size (in rows) but is always
I have an array which holds a record from a CSV file. Can I
In my iPad program I have an array which holds images. How can I
I have an array which contains dictionaries in it; so how can I sort
I have an array which I store different classes which again hold different arrays.
hey guys, i have an array which contains some elements, now i want to
I have an array which is being built using: $features_data[$i] = preg_split(/\n/, $row); The

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.