Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If GraphView.m is a UIView you won't get very far, as <code>performSegueWithIdentifier:sender</code> is a UIViewController method.</p> <p>Assuming that graphView is created from a viewController, you want to set it's delegate to the viewController.</p> <p>in GraphView.h</p> <ul> <li><p>declare a graphView protocol above your @interface:</p> <p><code>@protocol GraphViewDelegate</code><br> <code>-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index</code><br> <code>@end</code></p></li> <li><p>declare a property:</p> <p><code>@property (weak) id &lt;GraphViewDelegate&gt; delegate;</code></p></li> </ul> <p>in GraphView.m:</p> <pre><code>-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { [[self delegate] barPlot:plot barWasSelectedAtRecordIndex:index]; } </code></pre> <p>in ViewController.h modify the @interface line</p> <pre><code>@interface MyViewController: UIViewController &lt;GraphViewDelegate&gt; </code></pre> <p>in ViewController.m</p> <ul> <li><p>when you create the graphView, set the delegate to self (if graphView is created in Interface Builder, you can CTRL-drag a line to the viewController to set the delegate):</p> <p><code>GraphView* graphView = [GraphView alloc] init];</code><br> <code>[graphView setDelegate:self];</code></p></li> <li><p>implement the delegate method as you had it in GraphView (you may not need the <code>index</code> parameter but I carried it over anyway)..</p> <pre><code>-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { [self performSegueWithIdentifier:@"list2" sender:self]; } </code></pre></li> </ul> <p>You probably want to modify your method signature, to something like</p> <pre><code> -(void)graphView:(GraphView*)graphView didSelectBarAtIndex:(NSUInteger)index barPlot:(CPTBarPlot *)plot (it's good practice to send a reference to the sender along with the message) </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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