views:

37

answers:

1

I've been struggling with a strange problem which has arisen in using the CorePlot framework, but which I suspect isn't an error in the framework itself. I'm hoping somebody here will have seen something similar, and can point me in a productive direction.

I have a tabbed view in which graphs are shown. The tab that is initially active has no problems at all, but often when I open the next tab, I see the following:

http://imgur.com/J0VDs.png

Note that on the top graph, several labels are missing. If I switch back to the original tab, then to the second tab again, all is well every time. I've placed various diagnostic logging statements in and have determined that:

  1. The view is awake before the graph is created; and
  2. The drawInContext: method of each label is being called, including those that are missing. In fact, the axis labels are amongst the last things rendered, so I'd expect them to show if anything does, and some of the labels that are missing are being rendered after (and before) those that are present.

Because the rendering seems to be going ahead as it should, and because this thing draws fine "the second time around", I suspect that the problem is in how I'm hooking this up to the views, or in my timing there, and not in Core Plot itself (or, for example, in clipping). I'm out of ideas on how to debug this, though, and would love to hear from anybody who has experience with a similar problem.

Thanks!

A: 

The CALayer might not be caching the content in time before the CALayer is actually getting drawn.

Without seeing the code, I would suggest to try calling -setNeedsDisplay for the CALayer that is missing the label information as soon as you have changed the content for that CALayer.

Brock Woolf