【发布时间】:2015-04-28 00:13:36
【问题描述】:
我在xcode 中实现了core plot。我正在尝试将图例插入另一个cell。这是我如何实现legend 的代码。
- (void)configureLegend
{
CPTGraph *graph = self.hostView.hostedGraph;
CPTLegend *theLegend = [CPTLegend legendWithGraph:graph];
// Configure the legend
theLegend.numberOfColumns = 1;
theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]];
theLegend.borderLineStyle = [CPTLineStyle lineStyle];
theLegend.cornerRadius = 5.0;
// Add legend to graph
graph.legend = theLegend;
graph.legendAnchor = CPTRectAnchorRight;
CGFloat legendPadding = - (self.chartView.bounds.size.width / 8);
graph.legendDisplacement = CGPointMake(legendPadding, 0.0);
这是我尝试过的:
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
[cell addSubview:theLegend];
}
我收到以下错误:
Incompatible pointer types sending 'CPTGraph *' to parameter of type 'UIView *'
我理解错误,以及我做错了什么。我的问题是,如何将legend 添加为单元格的subview?
编辑
这就是我要说的:
我想将包含所有信息的部分 - “AAPL”GOOG”“MSFT”(右边的东西)移动到另一个单元格。
【问题讨论】:
标签: ios objective-c core-plot addsubview