开发者

iphone hostingView does not fit parent view

I have some problems with the layout of my core plot graph. To be more precise, I have created a GraphViewController (.h, .m and associated nib file). In the nib file I have added anothe开发者_运维知识库r UIView. This embedded view will be used to set the graph (as I do not want it to use the whole view). I then need to create a hosting view  from this embedded view. The embedded view is named graphView, I first though I needed to get the frame representing the graphView and create the hostingView so the graph will fit in the graphView. When I use the:     CPHostingLayerView *hostingView = [[CPHostingLayerview alloc] initWithFrame: [graphView frame]] ...

it does not work as expected, the graph does not fit the view (it is bigger than the graphView I created in IB)

Hope I am clear :( Any idea would be more than welcome. thanks a lot, Luc


I finally find an answer :) Instead of adding an UIView within IB and programmatically create a CPLayerHostingView, I directly declared the view as an CPLayerHostingView in IB, that works perfectly. Regards, Luc


I was stuck with the same issue. What worked for me is a simpler way : In super-view (where you are adding the core plot graph as a subview), add this code: [self.subview.graphHostingView setFrame:self.view.bounds];

where subview is the view with the core-plot graph. And add this code 'after' you have done the graph initialization in the sub-view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜