Mr *_*ohi 1 iphone objective-c core-plot ios
我正在使用Coreplot API创建条形图.当我尝试将这个相同的代码作为单个项目运行时,它工作正常但是当我将它集成到我的项目里面时UINavigationController它给了我一个错误.
GraphView.h
@interface GraphView : CPTGraphHostingView <CPTPlotDataSource, CPTPlotSpaceDelegate>
{
CPTXYGraph *graph;
NSArray *dates;
}
@property(nonatomic, retain) NSArray *dates;
Run Code Online (Sandbox Code Playgroud)
GraphView.m
dates = [NSArray arrayWithObjects:@"2012-05-01", @"2012-05-02", @"2012-05-03",
@"2012-05-04", @"2012-05-05", @"2012-05-06", @"2012-05-07", @"2012-05-08", @"2012-05-09",@"2012-05-10",@"2012-05-11",@"2012-05-12",@"2012-05-13",@"2012-05-14",@"2012-05-15",@"2012-05-16",@"2012-05-17",@"2012-05-18",@"2012-05-19",@"2012-05-20",nil];
- (NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
{
return dates.count;
}
Run Code Online (Sandbox Code Playgroud)
在返回dates.count它给我错误.
[__NSArrayI count]:发送到解除分配的实例0x6dbfd10的消息
您正在创建一个自动释放对象.将内存分配给日期数组.
dates = [[NSArray alloc]initWithObjects:@"2012-05-01", @"2012-05-02", @"2012-05-03",
@"2012-05-04", @"2012-05-05", @"2012-05-06", @"2012-05-07", @"2012-05-08", @"2012-05-09",@"2012-05-10",@"2012-05-11",@"2012-05-12",@"2012-05-13",@"2012-05-14",@"2012-05-15",@"2012-05-16",@"2012-05-17",@"2012-05-18",@"2012-05-19",@"2012-05-20",nil];
Run Code Online (Sandbox Code Playgroud)