I have a CALayer that needs to display frames of video. Every time a frame is rendered (as a CGImageRef), this method is called:
- (void)displayFrame:(CGImageRef)frame {
[view layer].contents = (id)frame;
}
What’s strange is that this, at first, will not display anything. Every time view is resized, a new frame is displayed, but sticks until view is resized again.
How do I fix this?
Is displayFrame: being called on the main thread? If not then I have found that it will not always draw. You can try forcing it to update by using [CATransaction flush] like:
If that does not work then you might try including the layer construction code to help identify any peculiarities with this layer.