42773

Send array to next viewcontroller iOs xcode [duplicate]

Question:

<blockquote>

<strong>Possible Duplicate:</strong><br /><a href="https://stackoverflow.com/questions/5210535/passing-data-between-view-controllers" rel="nofollow">Passing Data between View Controllers</a>

</blockquote>

I have 2 view controller:

<ol><li>Index </li> <li>Second</li> </ol>

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). How I can best realize? Please help! Best regards<br /> Ivan.

Answer1:

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]

Recommend

  • Apple Push Notifications - App store submission
  • How to properly create a RollingFileAppender with AppenderComponentBuilder in log4j 2
  • How to change WebBrowser fullscreen video mode?
  • Migrating MOSS 2007 from SQL 2000 to SQL 2005 [closed]
  • Jekyll - How do I create pages in the root directory?
  • can you use embedded ruby in custom javascript files in rails?
  • jQuery Ajax call to WCF service returning “Method not allowed (405)”
  • Load php page results into div with ajax with link?
  • Is possible having two COM STA instances of the same component?
  • How can I filter an array of dictionaries in 'updateSearchResultsForSearchController' to s
  • How to display converted time zones in a 'generic week' (Sunday thru Saturday)?
  • AWS RDS Parameter Group not changing MySQL encoding
  • Keep rows with certain values always at the bottom while sorting in jquery tablesorter plugin
  • How to define a custom accuracy in Keras to ignore samples with a particular gold label?
  • What does “T extends Junk” mean in a generic class in Java?
  • how to specify different css for ie
  • How do I use libcurl to printf a remote FTP directory listing?
  • Year over Year Stats from a Crossfilter Dataset
  • How can i move Clearcase dyamic/snapshot views to another host (Linux)
  • Annotate objects in a queryset with next and previous object ids
  • Tensorflow Dataset API restore Iterator after completing one epoch
  • Google Spreadsheet Script to Blink a range of Cells
  • Geokit in Ruby on Rails, problem with acts_as_mappable
  • how do i compare two rows and store the similarities of the two rows in another column
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • How to clear a browser cache in Protractor
  • Cloud Code: Creating a Parse.File from URL
  • how to run ejabberd with Erlang on Heroku?
  • How to use Streams api peek() function and make it work?
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • php “page caching” solution suggestions for CMS Applications
  • How to get rgb from transparent pixel in js
  • Grails - How to implement a foreign key relationship not using an id column?
  • Capture SIGFPE from SIMD instruction
  • Sign a Pdf using custom digital signature in Java
  • Jersey serializes character value to ASCII equivalent numeric string
  • CAS 4 - Not able to retrieve the LDAP groups after successful authentication
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?
  • ReferenceError: TextEncoder is not defined