Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK. Let's say you have two viewcontrollers <code>FirstViewController</code> and <code>SecondViewController</code>. In <code>FirstViewController</code> you have a tableview and of course tableviewcell. In <code>SecondViewController</code>you need to display data. So in <code>SecondViewController.h</code> you need to set a propery of some variable, in this case it is of <code>id</code> type <code>@property (strong, nonatomic) id secDetailItem;</code>. Synthesize it in <code>SecondViewController.m</code> and add a setter method like this </p> <pre><code>-(void)setDetdetailItem:(id)newSecdetailItem{ if (secDetailItem != newSecdetailItem) { secDetailItem = newSecdetailItem; // Update the view. [self configureView];//This method is needed to update view if there are some changes in that view. } } </code></pre> <p>So then in <code>FirstViewController.h</code> import <code>SecondViewController.h</code> and add property <code>@property (strong, nonatomic) SecondViewController *secondViewController;</code> then synthesize. In <code>FirstViewController.m</code> file in this delegate method do following:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ self.secondViewController.secDetailItem=//set your data should be passed. </code></pre> <p>//Also if you need to push viewcontroller add <code>pushviewcontroller:SecondViewController</code>, or use IB to connect tableview cell and SecondViewController together with push method. }</p> <p>In this case you will not need to use perform segue. The Setter method will work as soon as you set to the <code>secDetailItem</code> something.</p> <p>Also if you need to update your view in <code>SecondViewController</code> add this method to it.</p> <pre><code>- (void)configureView </code></pre> <p>{</p> <pre><code>if (self.secDetailItem) { self.textLabel.text=self.secDetailItem;//Data passed from FirstViewController } </code></pre> <p>}</p> <p>This is all you need to do. Sorry if it is complicated. Ask any question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload