Using the code below in coreplot(Barchart) to perform segue from GraphView.m class
but I get an error: instance method '-performSegueWithIdentifier:sender:' not found (return type defaults to 'id')
How do I fix it ? Please Help .
Thanks in Advance.
-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index
{
NSLog(@"barWasSelectedAtRecordIndex %d", index);
[self performSegueWithIdentifier:@"list2" sender:self];
}
If GraphView.m is a UIView you won’t get very far, as
performSegueWithIdentifier:senderis a UIViewController method.Assuming that graphView is created from a viewController, you want to set it’s delegate to the viewController.
in GraphView.h
declare a graphView protocol above your @interface:
@protocol GraphViewDelegate-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index@enddeclare a property:
@property (weak) id <GraphViewDelegate> delegate;in GraphView.m:
in ViewController.h modify the @interface line
in ViewController.m
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):
GraphView* graphView = [GraphView alloc] init];[graphView setDelegate:self];implement the delegate method as you had it in GraphView (you may not need the
indexparameter but I carried it over anyway)..You probably want to modify your method signature, to something like