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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:33+00:00 2026-06-17T09:10:33+00:00

I have 2 view controller: Index Second In Index I have 2 textfield and

  • 0

I have 2 view controller:

Index
Second
In Index I have 2 textfield and button.

I fill this text field and press “next button” to second view, I need to “show” this two text field, by using Array (later I will send JSON data).

I Tried this:
Declare an @property in class Second as textArray. And then while pushing to Second from Index, you need to set this property.

In Second.h file,

@property(nonatomic, strong) NSArray *textArray;

In Index.m file,

Second *aSecond = [[Second alloc] init];
aSecond.textArray = @[textField1.text, textField2.text];

//write code to push from Index to Second
Now in class Second, you can use it as aSecond.textArray[0] and aSecond.textArray[1]

But if i switch page (click next) array has been nulled.

For switch page i use this:

SecondPage *SecondPage = [self.storyboard instantiateInitialViewController];
    SecondPage = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondPage"];
    [self SecondPage animated:YES];

How I can best realize? Please help! Best regards
Ivan.

  • 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-17T09:10:34+00:00Added an answer on June 17, 2026 at 9:10 am

    There are lot of ways to transfer the value from one controller to an other, but for you I think this will be the most simple ever. Use NSUserDefaults

    First Easy Ways

    in first Controller

    [[NSUserDefaults standardUserDefaults] setObject:@[textField1.text, textField2.text] forKey:@"listOfData"];
    

    in 2nd Controller

    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:@"listOfData"];
    

    2nd Easy ways is

    DetailVC *detailVC = [self.storyboard instantiateInitialViewController];
    detailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailVC"];
    detailVC.textArray = @[textField1.text, textField2.text]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have view controller which contains a button which show the image library ,if
Possible Duplicate: Passing Data between View Controllers I have 2 view controller: Index Second
I have the* Topics * controller and in the view/topics/index.html.erb the link for destroying
I have a view controller with a scrollview with lots of text boxes, when
So I have a dashboard controller that points to the corresponding view. This file
In a controller/index action in my CakePHP2 app, I have $this->Model-find('all',array( ... lots conditions
I have view controller, into the view i have put a table view, and
I have a view controller based app that contains several views that I display/hide
I have a View controller displaying some information (not table views). I have an
I have a view controller that houses a UIWebView. I want to display an

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.