Capture frames of UIView

I was doing a little digging of information on making uiview recorder or more of capturing frames. I had this not so simple view hierarchy with 3D transformation going on. I had to capture decent frames and make video out of it.

I was rendering the layer of views into context and getting image back from context for each frames. Many implementaion of this method was used:

- (void)renderInContext:(CGContextRef)ctx

Frames were captured but without any of our 3D transformations. When looking at official documentation, it was found that this method totally ignores any animation and 3D transformations are never rendered. Hours of rubbing didn’t bring anything out but information learned is every worth it.

I came across a method that saved me. This is available only on ios7.0 and above. My poject is targeted for those version only so i didn’t hesitate to implement that. Every 3D tranformations were captured on frame. I was able to create an awesome video from those frames.

- (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates

Here is the detail and sample that will make you go on
https://developer.apple.com/library/ios/qa/qa1817/_index.html

Be the first to leave a comment. Don’t be shy.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>