title: Perform a Segue Called by a UITableViewCell
body: <p>I have some UIButtons in a custom table view cell that when pressed I want them to call segues in the view controller that is host to the table view that the cells are in. What I am doing now is declaring an action like this:
      - (void)action;</p>
  
  <p>in the class that the table view is in. And then I am calling that action from the cell like this:</p>
  
  <pre><code>ViewController *viewController = [[ViewController alloc] init];
  [viewController action];
  </code></pre>
  
  <p>However when the action is called it says that there is no such segue for the view controller which I know to be incorrect. Calling "action" from the view controller itself works perfectly, just not from the cell. </p>
  
  <p>Also, here is the code to perform the segue:</p>
  
  <pre><code>-(void)action {
       [self performSegueWithIdentifier:@"action" sender:self];
  }
  </code></pre>
  
  <p>How can I make this work?</p>
  
  <p>Any suggestions are appreciated.</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>I just tried to set a delegate on the cell like this:</p>
  
  <p>Cell's header file:
      @class PostCellView;</p>
  
  <pre><code>@protocol PostCellViewDelegate
  -(void)action;
  @end
  
  @interface PostCellView : UITableViewCell &lt;UIAlertViewDelegate, UIGestureRecognizerDelegate&gt;
  
  @property (weak, nonatomic) id &lt;PostCellViewDelegate&gt; delegate;
  </code></pre>
  
  <p>And in the main file for the cell I call the action like this:
      [self.delegate action];</p>
  
  <p>and in the header for the view that hosts the Table View I import the cell like this:
      #import "PostCellView.h"</p>
  
  <pre><code>@interface ViewController : UIViewController &lt;UITableViewDelegate, UITableViewDataSource, PostCellViewDelegate&gt;
  </code></pre>
  
  <p>Then in the main file for that view I have the cells action:</p>
  
  <pre><code>-(void)action {
  
      [self performSegueWithIdentifier:@"action" sender:self];
  
  }
  </code></pre>
  
  <p>But the action is never performed, I checked. I logged when I call the action from the cell and I put an NSLog on the action itself and the log for calling it from the cell worked but not the action.</p>