Wednesday, June 12, 2024
HomeiOS Developmentswift - How you can take a big snapshot in iOS

swift – How you can take a big snapshot in iOS


In my case, I must output a comparatively giant ground plan, and I simplified the code as follows. Within the case of a comparatively giant measurement, the right picture can’t be output

Pattern Code

let image1Size = CGSize(width: 400, peak: 3000)
let size1 = CGSize(width: 430, peak: 682)
    
let testView = UIView(body: CGRect(origin: .zero, measurement: image1Size))
testView.backgroundColor = .pink
    
let testImage = UIGraphicsImageRenderer(measurement: image1Size).picture { context in
    testView.drawHierarchy(in: CGRect(origin: .zero, measurement: image1Size), afterScreenUpdates: true)
}
    
let test2View = UIView(body: CGRect(origin: .zero, measurement: size1))
test2View.backgroundColor = .pink
    
let test2Image = UIGraphicsImageRenderer(measurement: size1).picture { context in
    test2View.drawHierarchy(in: CGRect(origin: .zero, measurement: size1), afterScreenUpdates: true)
}

end result:
error picture
count on picture

I count on to have the ability to output the right picture at a comparatively giant measurement, or another giant picture output attainable



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments