2014-02-06 2 views
2

Работа с диаграммой строк с использованием библиотеки ядра. Он выдает исключение Invalid Argument. Я сделал проект septate и создаю xib-файл, и я связал этот xib-файл с CPDScatterPlotViewController. Он работает и работает, но когда я пытался интегрироваться с моим проектом, он генерирует исключения. Используя этот код:NSInvalidArgumentException ', reason:' - [__ NSCFConstantString sizeWithTextStyle:]: непризнанный селектор, отправленный в экземпляр 0x170838

#import "CPDScatterPlotViewController.h" 

@implementation CPDScatterPlotViewController 

@synthesize hostView = hostView_; 

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

-(void)didReceiveMemoryWarning { 
    // Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 
    // Release any cached data, images, etc that aren't in use. 
} 

#pragma mark - UIViewController lifecycle methods 
-(void)viewDidAppear:(BOOL)animated { 
    [super viewDidAppear:animated]; 
    [self initPlot]; 
} 

#pragma mark - Chart behavior 
-(void)initPlot { 
    [self configureHost]; 
    [self configureGraph]; 
    [self configurePlots]; 
    [self configureAxes];  
} 

-(void)configureHost { 
    self.hostView = [(CPTGraphHostingView *) [CPTGraphHostingView alloc] initWithFrame:self.view.bounds]; 
    self.hostView.allowPinchScaling = YES;  
    [self.view addSubview:self.hostView];  
} 

Ошибка произойден на CPTMutableTextStyle во время отладки.

-(void)configureGraph { 
     // 1 - Create the graph 
     CPTGraph *graph = [[CPTXYGraph alloc] initWithFrame:self.hostView.bounds]; 
     [graph applyTheme:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; 
     self.hostView.hostedGraph = graph; 
     // 2 - Set graph title 
     NSString *title = @"Portfolio Prices: April 2012"; 
     graph.title = title; 
     // 3 - Create and set text style 
     CPTMutableTextStyle *titleStyle = [CPTMutableTextStyle textStyle]; 
     titleStyle.color = [CPTColor whiteColor]; 
     titleStyle.fontName = @"Helvetica-Bold"; 
     titleStyle.fontSize = 16.0f; 
     graph.titleTextStyle = titleStyle; 
     graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; 
     graph.titleDisplacement = CGPointMake(0.0f, 10.0f); 
     // 4 - Set padding for plot area 
     [graph.plotAreaFrame setPaddingLeft:30.0f];  
     [graph.plotAreaFrame setPaddingBottom:30.0f]; 
     // 5 - Enable user interactions for plot space 
     CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace; 
     plotSpace.allowsUserInteraction = YES; 
    } 


    @end 
+0

Какая линия делает его падение на? – trojanfoe

+0

Им жаль по этой строке: graph.title = title; –

ответ

Смежные вопросы

 Смежные вопросы