我有很多图例条目,有谁能帮我使 CPTLegend
可滚动?
这是我正在使用的 CPTLegend
代码。
-(void)configureLegend {
// 1 - Get graph instance
CPTGraph *graph = self.hostView.hostedGraph;
// 2 - Create legend
CPTLegend *theLegend = [CPTLegend legendWithGraph:graph];
// 3 - Configure legen
theLegend.numberOfColumns = 1;
theLegend.fill = [CPTFill fillWithColor:[CPTColor clearColor]];
theLegend.borderLineStyle = [CPTLineStyle lineStyle];
theLegend.cornerRadius = 2.0;
// 4 - Add legend to graph
graph.legend = theLegend;
graph.legendAnchor = CPTRectAnchorBottom;
CGFloat legendPadding = -(self.view.bounds.size.width / 3);
graph.legendDisplacement = CGPointMake(-80, 120.0);
}