I have a screenshot button set up so that i can capture the entire view controller (except my status bar an navigation bar) and input that image to the camera roll. The only problem is that if i try to print this image from my camera roll, it prints an image only 1/4 of the page size. The image is too small, and i need it to be 850 by 1100.
How exactly could you code my screenshot to print, instead of a save to camera roll - and to specifically print 850 by 1100.
This is what my screenshot looks like:
///////// screenshot save
@IBAction func buttonAction(_ sender: UIButton) {
//partial screenshot function
let top: CGFloat = 46
let bottom: CGFloat = 0
let size = CGSize(width: view.frame.size.width, height: view.frame.size.height - top - bottom)
UIGraphicsBeginImageContextWithOptions(size, false, 0)
let context = UIGraphicsGetCurrentContext()!
context.translateBy(x: 0, y: -top)
view.layer.render(in: context)
let snapshot = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
//Save photo to camera roll
UIImageWriteToSavedPhotosAlbum(snapshot!, nil, nil, nil)
//Flash screen when photo is saved
let shutterView = UIView(frame: view.frame)
shutterView.backgroundColor = UIColor.black
view.addSubview(shutterView)
UIView.animate(withDuration: 0.3, animations: {
shutterView.alpha = 0
}, completion: { (_) in
shutterView.removeFromSuperview()
})
}
Please help! i have no idea what I'm doing