objective c - Error: "-[UIView setHostedGraph:]: unrecognized selector" while executing the core plot in iPhone app -


i below error when try compile below code:

* terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiview sethostedgraph:]: unrecognized selector sent instance 0x6768c10'

code:

 uiview *chartview;    chartview = [[uiview alloc] init];   graph = [[cpxygraph alloc] initwithframe: chartview.bounds];  cpgraphhostingview *hostingview = (cpgraphhostingview *)chartview; hostingview.hostedgraph = graph; 

what wrong?

please , suggest.

thanks

you're casting uiview instance (which not respond -sethostedgraph:) cpgraphhostingview. - not work.

you'll need create actual cpgraphhostingview object, then invoke -sethostedgraph: on it.

so, code should this:

cgrect someframe = ...; cpgraphhostingview *hostingview = [[cpgraphhostingview alloc] initwithframe:someframe]; graph = [[cpxygraph alloc] initwithframe: hostingview.bounds];  hostingview.hostedgraph = graph; 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -