I am using core plot and I am getting an error
I am using core plot and I am getting an error
"'*** -[UIView setHostedLayer:]: unrecognized selector sent to inst开发者_Python百科ance 0xf283a0'"
at line
hostingView.hostedLayer = graph;
I had this problem too! I just figured out the solution: you need to open up the xib file for your view controller class, the one where you setup the pie chart, and in there you will need to select the view, then make the view a CPLayerHostingView type. If you're unsure how to do this, go to the "Identity Inspector" window, and under Class Identity (the first item in the Identity Inspector window, enter CPLayerHostingView for the "class" value. When you do this, the view will then be labelled as "Layer Hosting View". Save and close the .xib, then go back to Xcode and build. It should work at that point.
Sorry if this way is extraneous and there is a better way, but this is how I finally got it to work. Hit me up if you have any further questions or need more explanation. Good luck!
Andy
Make your View a CPTGraphHostingView
. It worked for me.
I got the same error, but it was due to typecasting of UIView
into CPGraphHostingView
. I got the solution at this link:
Error: "-[UIView setHostedGraph:]: unrecognized selector" while executing the core plot in iPhone app
You hostingView has to be a CPLayerHostingView
, not a generic UIView
. Make sure it is specified correctly in Interface Builder or in your setup code if you're creating it manually.
I was upgrading to the latest version of CorePlot (as of 1-9-2012) and had this error.
-[UIView setCollapsesLayers:]: unrecognized selector sent to instance
I found that my view was still set to the old CPGraphHostingView
, even though it had been replaced in the code with the new version. From the tip above, I changed the view to the new value of CPTGraphHostingView
.
Notice in the new version of CorePlot the name prefixes were changed from "CP" to "CPT".
精彩评论