gpt4 book ai didi

ios - 如何为 ios 拍摄 AGSMapView 的快照?

转载 作者:行者123 更新时间:2023-11-28 08:36:03 26 4
gpt4 key购买 nike

      UIGraphicsBeginImageContextWithOptions(self.AgsMapView.bounds.size,false, 0.0)
self.view.layer.renderInContext(UIGraphicsGetCurrentContext()!)
snapShot = UIGraphicsGetImageFromCurrentImageContext()

他是我的代码,从上面的代码得到空白图像(白色)

最佳答案

试试这个代码!!

    let layer = self.AgsMapView.layer
let scale = UIScreen.mainScreen().scale
UIGraphicsBeginImageContextWithOptions(self.AgsMapView.frame.size, false, scale);
layer.renderInContext(UIGraphicsGetCurrentContext()!)
let snapShot = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil)

关于ios - 如何为 ios 拍摄 AGSMapView 的快照?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37655227/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com