Screenshots-A Legal Way To Get Screenshots

Note: Please remember that this post is over 5-years old, is not therefore current, so code at your own risk.

Screenshot 2011 03 25 04 23 15Well, Screenshots is finally done. So, what took so long since the last post about Screenshots on March 7th?

The worst thing about having perfectionist attributes is that sometimes they are detriments. Take, for example, my initial Screenshots demo app. Yes, it worked in so much as it did demonstrate that by using Apple’s Q&A 1702, 1703, 1704, and 1714 you could get they type of screen shot, or screen image, that you could by using UIGetScreenImage(). But it was…how best to put it, so ugly that not even its coder (I) could love it. So I rewrote it. All of it. And then I added features. Yeah…like I said, a detriment.

Ok…so what took so long?


The first thing is that I wanted this to be a step-by-step app that one could grab and, after opening it, get the flow of what was going on. That meant no more having one view with several buttons, each of which gave the desired result. Meanwhile, the code was a hodgepodge amalgam of the code from the Apple Q&A’s as well as my own customizations. So I turned the Screenshots app from a single view to one that opens to a table view. Each row of the table view clearly states the example that you, the user, are about to see. Lastly, in the view of each example I linked the example to the proper Apple Q&A web page.

Finally, I gave it to Apple’s OpenGL ES XCode template. The way I was taught to write OpenGL did not involved throwing into the view controller a bunch of code for the OpenGL view. Apple does it differently; -drawView and other methods are enclosed in the EAGLViewController implementation file. After fighting this for a couple of years, it seemed to me that while this may be a fun battle for me, for anyone looking at how I implemented Q&A 1704 and Q&A 1714 would wonder what planet my OpenGL code was written on. So I rewrote the OpenGL screen capture around the Apple template. The only changes I made were to turn-off OpenGL ES 2.0. Sorry. However, the code for OpenGL ES 2.0 was not deleted, so you can easily follow what I did.

But that wasn’t all. With UIGetScreenImage() it was possible to grab the whole main screen, including the status bar, navigation bar, etc.; in other words, the whole kit-and-caboodle. That, sadly, is not possible any longer. I’ll go into details in another post, but the bottom line is that none of the Apple work-arounds will capture the status bar. The navigation bar and tab bar are not problem. And so I added a nice little way to capture the navigation bar in a screenshot, or not, all depending upon your preference.

I will post more on this at some point. Until then, if you have issues, please email me at jimhillhouse _at_ me _dot_ com.

Now, here’s where you can get the code.

BTW, this code is covered by the Creative Commons license. If you modify Screenshots, please share. If you use it to make money, that’s very cool. If you make a lot of money, maybe you can slide over to me a nice bottle of Scotch, though it’s not a requirement.

Screenshots Final ScreenShots

Creative Commons License
Screenshots by Jim Hillhouse is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at