There doesn't appear to be a great solution in the iOS platform for taking a screenshot of a section of a UIView. This is an issue that I ran into while doing some iPad development recently. The requirement was to determine the bounds of all of the subviews (which are free floating and arranged by the user) in an very large UIView and convert that rectangle subsection of the UIView that corresponds with the bounds to a UIImage. Creating a PNG of the entire UIView was not acceptable because it caused the size of the images to explode due to all of the extra empty space. What I came up with is admittedly a hack, but it works for me and it works well for the application in which it is used. Maybe it will work for you as well.
Please let me know if you know a better way to do this! I'd love to hear it.
The basic strategy is this:
Viola! A screenshots of a section of the view. Here's some code.
Code to get the bounds of my CGRect:
In my view controller. Code to take the screenshot: