Tag: cptbarplot

在CPTBarPlot上定位标签(Core-Plot)

我正在尝试使用Core-Plot更改条形图中标签的默认位置。 我正在使用这个方法: -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx; 我回来了: return textLayer = [[CPTTextLayer alloc] initWithText:@"2222" style:textStyle]; 我得到这个结果: 但是我想要显示如下: 任何想法? 我试图find关于文件的答案,但我已经不可能了。

UICollectionView的单元格在滚动后并不总是被刷新

我在Storyboard(iPad)中定义了一个包含UICollectionView的视图,在视图底部还有一个UIToolbar 。 在UICollectionView我添加了一个UICollectionViewCell (由一个iPadCellCollectionViewCell类实现),它包含另一个视图,即核心图( CPTGraphHostingView类)。 我有一个名为X的类实现了UICollectionViewDelegate和UICollectionViewDataSource 。 在类X中,我为我的视图(在ViewDidLoad )的每个单元格构buildCore-Plot Graph,并且具有以下代码将图链接到UICollectionViewCell的单元格 – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellId = @"ChartCollectionId"; iPadCellCollectionViewCell* cell = [self.theCollectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; MyChart* chart = [_charts objectAtIndex:indexPath.row]; cell.hostingView.hostedGraph = chart.barChart; return cell; } 它工作正常,所有我的graphics正确显示在屏幕上。 当用户滚动视图时会发生问题,然后一个或多个单元格变为“空白”。 我真的不明白为什么。 我find了一种解决方法,而不是在界面生成器中的UICollectionViewCell中添加CPTGraphHostingView ,我自己构build它,并且之前的代码变为: – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellId = […]