解决了问题。
交互逻辑包含在
CPLayerHostingView.m
文件。
如果您需要将
ViewController
具有
CPLayerHostingView
,只需添加属性:
@interface CPLayerHostingView : UIView<CPPlotDataSource> {
@protected
CPLayer *hostedLayer;
CPTestAppScatterPlotController *touchController;
}
@property (nonatomic, readwrite, retain) CPLayer *hostedLayer;
@property (nonatomic, readwrite, retain) CPTestAppScatterPlotController *touchController;
然后在
可视控制器
使用代码:
CPLayerHostingView *hostingView = (CPLayerHostingView *)self.view;
hostingView.touchController = self;
所以现在您可以从视图中运行任何控制器的视图方法。