tags:

views:

39

answers:

2

hi, i am using core plot framework,when i run following code in viewdidload gives crash.the view is as custom view...

graph = [(CPXYGraph *)[CPXYGraph alloc] initWithFrame:CGRectZero];
CPLayerHostingView *hostingView = (CPLayerHostingView *)self.view;
hostingView.hostedLayer = graph;**(gives error)**

what i have to do? any help please?

A: 

What error are you getting? Is self.view a CPLayerHostingView or some other kind of UIView?

Eric Skroch
self.view is normal UIView.
Mikhail Naimy
+1  A: 

You can't just cast self.view to a CPLayerHostingView. You need to make sure it is actually is one. You can do that in Interface Builder or in code if you're initializing your view that way.

Eric Skroch