Edit: Thus, the following works in the simulator, but does not work on the device. I'm currently looking for a solution.
Here is a solution that in my opinion uses the Awesome Screenshot app:
func captureScreen() -> UIImage { // Get the "screenshot" view. let view = UIScreen.mainScreen().snapshotViewAfterScreenUpdates(false) // Add the screenshot view as a subview of the ShareViewController view. self.view.addSubview(view); // Now screenshot *this* view. UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, false, 0); self.view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true) let image: UIImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // Finally, remove the subview. view.removeFromSuperview() return image }
source share