CorePlot 1.4 を統合しようとしている iOS7 アプリケーションがあります (依存プロジェクトのインストール)。
@property (nonatomic) CPTGraphHostingView *hostingView;
と
_hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectNull];
(_hostingView
自動レイアウトの対象です。)次にグラフを追加すると:
CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
_hostingView.hostedGraph = graph;
私は最初にこの例外を受け取ります:
-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900'
5 myapp 0x00074325 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 1141
6 myapp 0x00075662 -[CPTAxis relabel] + 1202
必死になって、私はこれを次のように修正しましupdateAxisLabelsAtLocations:inRange:useMajorAxisLabels
た:
NSDictionary *textAttributes = nil;
BOOL hasAttributedFormatter = FALSE;
次に、次の例外を取得します。
-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90'
5 myapp 0x00081520 -[CPTTextLayer sizeThatFits] + 320
6 myapp 0x0008163c -[CPTTextLayer sizeToFit] + 108
7 myapp 0x00080559 -[CPTTextLayer initWithText:style:] + 313
8 myapp 0x00074b87 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 3159
9 myapp 0x00075672 -[CPTAxis relabel] + 1202
次に、次の行をコメントアウトして、これを「修正」しましたsizeThatFits
。
else {
// textSize = [myText sizeWithTextStyle:self.textStyle];
}
次の例外は次のとおりです。
-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0'
5 myapp 0x00081dc8 -[CPTTextLayer renderAsVectorInContext:] + 1144
6 myapp 0x00063f60 -[CPTLayer drawInContext:] + 112
のコードの下にコメントアウトすることで修正されますrenderAsVectorInContext
。
else {
// [myText drawInRect:newBounds
// withTextStyle:self.textStyle
// inContext:context];
}
最終的に例外はスローされず、グラフの境界線が表示されます。しかし、データ/凡例などを追加し始めると、新しい例外がスローされます:(
軸などにテキストは表示されません。もちろん、これはコードをコメントアウトしたためです。しかし、これらの例外がスローされる理由の手がかりはありますか? 私は絶望的です;S
統合の基本的な何かを見逃しているようです。しかし、私の統合 (ただし CorePlot 1.3) は、少し前に Xcode4 の iOS6 アプリで正常に機能しました。