Как сохранить UIView в размере 1920x1080px - PullRequest
0 голосов
/ 02 января 2019

У меня есть UIView, в котором textfield и изображение будет загружено в UIImage, у меня есть сохранение всего, что входит в область UIView, но сохраняется в низком разрешении, и мне нужно определенноеразмер.

размер uiview на раскадровке

@IBAction func shareButton(_ sender: AnyObject) {
    renderImageWithText()
}

// RENDER IMAGE WITH TEXT
func renderImageWithText() {
    let rect = cropView.bounds

    UIGraphicsBeginImageContext(CGSize(width: cropView.frame.size.width, height: cropView.frame.size.height))
    cropView.drawHierarchy(in: CGRect(x: 0.0, y: 0.0, width: cropView.frame.size.width, height: cropView.frame.size.height), afterScreenUpdates: true)

    imageToBeShared = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    openShareMenu()    
}


// OPEN SHARE
func openShareMenu() {

    let shareItems = [imageToBeShared!] as [Any]
    let actVC = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
    actVC.excludedActivityTypes = [.print, .postToWeibo, .copyToPasteboard, .addToReadingList, .postToVimeo]
    if UIDevice.current.userInterfaceIdiom == .pad {
        // iPad
        let popOver = UIPopoverController(contentViewController: actVC)
        popOver.present(from: CGRect(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2, width: 0, height: 0), in: self.view, permittedArrowDirections: .down, animated: true)
    } else {
        // iPhone
        present(actVC, animated: true, completion: nil)
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...