Ios 为什么文字颠倒了?
我实现了我的Ios 为什么文字颠倒了?,ios,objective-c,core-plot,Ios,Objective C,Core Plot,我实现了我的xcode项目。我正在尝试将图例添加到另一个单元格 我可以将图例添加到另一个单元格中,但当我这样做时,文本是颠倒的 这是我的密码: - (void)configureLegend { CPTGraph *graph = self.hostView.hostedGraph; CPTLegend *theLegend = [CPTLegend legendWithGraph:graph]; // Add legend to graph graph.leg
xcode
项目。我正在尝试将图例添加到另一个单元格
我可以将图例添加到另一个单元格中,但当我这样做时,文本是颠倒的
这是我的密码:
- (void)configureLegend
{
CPTGraph *graph = self.hostView.hostedGraph;
CPTLegend *theLegend = [CPTLegend legendWithGraph:graph];
// 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.layer addSublayer:graph.legend];
这就是我所尝试的:
theLegend.transform = CATransform3DMakeRotation(M_PI / 180.0f, 0, 1, 0);
}
那没什么用。结果是一样的。为什么会发生这种情况,我如何才能让文本正常显示,而不是倒置
编辑
当我将其添加为子层时,它就是这样显示的:(它说:“第一”,“第二”。尝试M_PI/2.0f
,以弧度为单位。在这个函数的上下文中,使用180.0f(大概是度)是没有意义的。Core Plot在iOS上应用翻转变换,因此我们可以在Mac和iOS上使用相同的绘图代码。这是它使用的变换:
self.layer.sublayerTransform = CATransform3DMakeScale( CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0) );
还是不行。我想问题是,我尝试访问传奇的方式。因为无论我输入什么值,它都不会改变。我做了cell.layer.sub。。。。里面所有的东西都倒了。然后我尝试了legend.layer.sub。。。。它说我做不到。图层???图例是一个CALayer
。直接在其上设置转换
。我尝试了legend.sublayer…
,但它对传奇没有任何影响正如名字所说,sublayerttransform
只影响子层。设置变换
以影响图层及其子图层。