Questions tagged [uigraphicsrenderer]
10 questions
3
votes
1 answer
Swift: UIGraphicsImageRendererFormat instead of UIGraphicsBeginImageContext returning blank image
I'm replacing UIGraphicsBeginImageContext with UIGraphicsImageRendererFormat to optimize performance and modernize my code. For some reason, UIGraphicsImageRendererFormat is returning a blank image in my function. I must be doing something…

Chewie The Chorkie
- 4,896
- 9
- 46
- 90
2
votes
0 answers
How to render a UIView to a UIImage Faster
I'm trying to render a UIView (with subviews) into a UIImage.
I'm using the new iOS 10+ UIGraphicsImageRenderer as seen below
let renderer = UIGraphicsImageRenderer(size: view.bounds.size)
let image = renderer.image { ctx in
…

siefix
- 916
- 1
- 10
- 19
2
votes
3 answers
Screenshot a view with label and transparent background in iOS and upload it to server
I want to screenshot a view and create an UIImage from it. I want the transparency attribute of the view to be maintained in my image. I tried this method after creating an extension of UIImage but the background is not transparent in the resultant…

Ankit Kumar Gupta
- 3,994
- 4
- 31
- 54
1
vote
1 answer
Crash on creating an image from UIGraphicsImageRenderer
i'm getting a Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when
layer.render(in: context) is called
where i'm trying to create a snapshot image from a custom window
let renderer = UIGraphicsImageRenderer(bounds: bounds, format: .init(for:…

Hilal
- 23
- 1
- 7
1
vote
1 answer
How do I stop drawHierarchy from making my app flicker/flash?
I'm trying to convert my app's main view into PDF data using UIGraphicsPDFRenderer. The code sort of looks like this:
let pdfRenderer = UIGraphicsPDFRenderer()
let pdfData = pdfRenderer.pdfData { context in
context.beginPage()
…

Connor
- 156
- 1
- 11
1
vote
1 answer
screenShot image with Avplayer ios 10* is Black image
extension UIView {
func capture() -> UIImage? {
var image: UIImage?
if #available(iOS 10.0, *) {
let format = UIGraphicsImageRendererFormat()
format.opaque = isOpaque
let renderer =…

banto nan
- 11
- 4
1
vote
2 answers
Retrieving pixel data not working correctly with UIGraphicsImageRenderer image
I have the following code to get the pixel data from a UIImage, this works for most images however does not work when I create an image using the UIGraphicsImageRenderer. I was hoping someone knew a solution to this.
My current code generates a…

Liam Vinson
- 71
- 1
- 7
1
vote
0 answers
Resizing/Scaling PDF Pages when converting each UIView into NSMutableData
I have this simple function that accepts an array of UIViews which are of the same sizes which basically could accept either large or smaller views. Then the function would be responsible for scaling each UIView into a 612 x 792 dimensions.
How…

Jojo Narte
- 2,767
- 2
- 30
- 52
1
vote
1 answer
How to use UIGraphicsRendererFormat for UIGraphicsImageRenderer?
I need to use UIGraphicsRendererFormat for my UIGraphicsImageRenderer to change its scale but I can't find even one example online. This is my code, I appreciate any help:
//Based on documentation I know that I have to create an instance…

Reza.Ab
- 1,195
- 1
- 11
- 21
-1
votes
1 answer
How to use `prepare(_ context: CGContext, with rendererContext: UIGraphicsRendererContext)`?
Starting iOS 10, Apple documents this class function in UIKit:
class func prepare(_ context: CGContext,
with rendererContext: UIGraphicsRendererContext)
However, I was not able to access prepare in Xcode 8.3.3:
// error: Type…

Cœur
- 37,241
- 25
- 195
- 267