문제가 있습니다. x 축 값 비율을 변경해야합니다. 지금은 0, 0.5, 1.0, 1.5, 2.0 ... 0, 1, 2, 3이 되길 원합니다 ... 어떻게해야합니까? 제가 사용하는 코드는 다음과 같습니다 :코어 플롯 x 축의 비율 축척 및 버튼 추가
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
[graph applyTheme:[CPTTheme themeNamed:kCPTDarkGradientTheme]];
CPTGraphHostingView *hostingView = (CPTGraphHostingView*)self.view;
hostingView.hostedGraph = graph;
graph.paddingTop = 20;
graph.paddingRight = 20;
graph.paddingLeft = 20;
graph.paddingBottom = 50;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace*)graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromString(@"-0.5") length:CPTDecimalFromString(@"5")];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromString(@"-2.5") length:CPTDecimalFromString(@"5")];
plotSpace.allowsUserInteraction = YES;
CPTScatterPlot *mainPlot = [[[CPTScatterPlot alloc] initWithFrame:graph.bounds] autorelease];
CPTMutableLineStyle *line = [[CPTMutableLineStyle alloc] init];
[line setLineColor:[CPTColor blueColor]];
[line setLineWidth:1.5f];
mainPlot.identifier = @"Main Plot";
[mainPlot setDataLineStyle:line];
mainPlot.dataSource = self;
[graph addPlot:mainPlot];
[line release];
그리고 또한보기의 맨 아래에 버튼을 추가해야합니다. 나는 IB의 단추를 뽑아 내 콘센트에 연결했습니다. [hostingView.superview bringSubviewToFront:backButton];
을 사용하여 앞에 가져 왔지만 운이 없었습니다. 어떻게해야합니까?
편집 : [self.view bringSubviewToFront:backButton];
을 사용하여 앞면에 단추를 가져올 수 있었지만보기 중간에 단추가 반영되었습니다. 이것도 어떻게 가능할 지 모르십니까? 어떻게 수정합니까?
'CPTHostingView'를 기본보기에 하위보기로 추가하려면 어떻게합니까? 나는'[self.view addSubview : hostingView];를 시도했으나 기대했던대로 작동하지 않았다. – Majster
나는 문제를 해결했다. host-view를 alloc-init하지 않았습니다. 그 지금 일하고있어. 감사. – Majster