Jen*_*zer 2 core-plot ios7 xcode5
我有一个iOS7应用程序,我试图将CorePlot 1.4集成到(从属项目安装).
@property (nonatomic) CPTGraphHostingView *hostingView;
Run Code Online (Sandbox Code Playgroud)
和
_hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectNull];
Run Code Online (Sandbox Code Playgroud)
(_hostingView受自动布局限制.)如果我然后添加图表:
CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
_hostingView.hostedGraph = graph;
Run Code Online (Sandbox Code Playgroud)
我首先得到这个例外:
-[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
Run Code Online (Sandbox Code Playgroud)
无奈之下,我已经updateAxisLabelsAtLocations:inRange:useMajorAxisLabels通过以下方式解决了这个问题:
NSDictionary *textAttributes = nil;
BOOL hasAttributedFormatter = FALSE;
Run Code Online (Sandbox Code Playgroud)
然后得到下一个异常:
-[__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
Run Code Online (Sandbox Code Playgroud)
然后我通过评论这一行来"修复"这个sizeThatFits:
else {
// textSize = [myText sizeWithTextStyle:self.textStyle];
}
Run Code Online (Sandbox Code Playgroud)
然后是下一个例外:
-[__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
Run Code Online (Sandbox Code Playgroud)
通过在下面的代码中注释掉来修复renderAsVectorInContext:
else {
// [myText drawInRect:newBounds
// withTextStyle:self.textStyle
// inContext:context];
}
Run Code Online (Sandbox Code Playgroud)
现在最后不会抛出任何异常并显示图形边框.但是,如果我然后开始添加数据/图例等,则抛出新的异常:(
轴上没有显示文字等.当然这是因为我已经注释掉了代码.但任何线索为什么抛出这些异常?我很绝望; S
似乎我错过了整合中的一些基本信息.但是我的集成(虽然CorePlot 1.3)在Xcode4上的iOS6应用程序中运行良好.
| 归档时间: |
|
| 查看次数: |
2271 次 |
| 最近记录: |