Swift: Cropping a Screenshot without TabBar and NavigationBar
I have a screenshot of the entire screen, screenshot , generated using the following: let layer = UIApplication.sharedApplication().keyWindow!.layer let scale = UIScreen.mainScreen().scale UIGraphicsBeginImageContextWithOptions(layer.frame.size, false, scale); layer.renderInContext(UIGraphicsGetCurrentContext()) let screenshot = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() I'd like to crop it so that the tab bar is not included, and I tried using the following code: let crop = CGRectMake(0, 0, //"start" at the upper-left corner self.view.bounds.width, //include half