Ios 单击条形图列后,在coreplot Graphview.m中Segue不工作

Ios 单击条形图列后,在coreplot Graphview.m中Segue不工作,ios,ios6,core-plot,Ios,Ios6,Core Plot,在coreplot(条形图)中使用下面的代码从GraphView.m类执行segue 但我得到一个错误:实例方法“-performsguewithidentifier:sender:“未找到(返回类型默认为“id”) 我怎么修理它?请帮忙。 提前谢谢 -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecord

在coreplot(条形图)中使用下面的代码从GraphView.m类执行segue

但我得到一个错误:
实例方法“-performsguewithidentifier:sender:“未找到(返回类型默认为“id”)

我怎么修理它?请帮忙。
提前谢谢

-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index
    {
        NSLog(@"barWasSelectedAtRecordIndex %d", index);

         [self performSegueWithIdentifier:@"list2" sender:self];
    }

找不到该方法如果您确定没有任何拼写错误,您也可以尝试将该方法包含在.h文件中。

如果GraphView.m是UIView,您不会走得太远,因为
performsgueWithIdentifier:sender
是UIViewController方法

假设graphView是从viewController创建的,则需要将其委托给viewController

在GraphView.h

  • 在@interface上声明graphView协议:

    @protocolgraphviewdelegate

    -(void)条形图:(CPTBarPlot*)选择了绘图条形图索引:(nsInteger)索引

    @end

  • 申报财产:

    @属性(弱)id委托

在GraphView.m中:

-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index
    {
        [[self delegate] barPlot:plot barWasSelectedAtRecordIndex:index];
    } 
在ViewController.h中修改@interface行

@interface MyViewController: UIViewController <GraphViewDelegate>
您可能想要修改您的方法签名,例如

            -(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)

Graphview只是一个类。那么如何在上面所示的方法中使用Identifier:sender执行GuegueWithIdentifier?您真的想将其发送到您的viewController-更好的是,使用委托向viewController发送消息-从Graphview的角度看这有意义吗?如何做到?请帮助。是否有创建图形视图的UIViewController?谢谢,先生。我尝试了TargetViewController targetVC=(TargetViewController)segue.destinationViewController;targetVC.string1=string1;正如Prajwal先生所建议的,它仍然不起作用。我没有犯任何拼写错误。这是一个我正在尝试调用的类,在该类的方法中使用identifier:sender调用performsguewithidentifier:sender。我该如何做?这可能会有帮助吗
            -(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)