Questions tagged [uigraphicscontext]

The UIGraphicsContext is not a class as you might think, but a set of functions that allows access to functions of CGContext. UIGraphicsContext is often used to create images or PDFs from code.

The UIGraphicsContext is the programmatic interface to the graphics contexts.

Since iOS 10 and tvOS 10 UIGraphicsRenderer and its subclasses facilitates the creation of documents via UIGraphicsRendererContext, which are based on Objective-C / Swift classes. The creation process is quite similar to working with functions from UIGraphicsContext so that these functions become less and less important.

314 questions
2
votes
2 answers

OSX UIGraphicsBeginImageContext

I have an iOS app that I am now creating for Mac OSX. I have the code below that converts the image to a size of 1024 and works out the width based on the aspect ratio of the image. This works on iOS but obviously does not on OSX. I am not sure how…
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82
2
votes
2 answers

Screenshot of animated Image

I have one imageview which is changing on every few seconds with curl animation. I want to take the video of that so for that what I am doing is, I take the screenshots every seconds and create video from that. But I am unable to take the screenshot…
2
votes
1 answer

Create UIImage from UICollectionView Visible Area

I have a collection view that scrolls horizontally. I need to create a UIImageView from the currently visible portion of the collection view. I usually use the following method for this: + (UIImageView *) imageCopyOfView:(UIView *)inputView { …
RegularExpression
  • 3,531
  • 2
  • 25
  • 36
2
votes
2 answers

Drawing a circular image on top of another image - UIGraphicsBeginImageContextWithOptions

I've been struggling with this method for a while. I am drawing an avatar on top of another image. The user picture I want to be a circle, however I can't seem to figure out how. The user picture is a UIImage and not a UIImageView. I am aware of how…
DevC
  • 6,982
  • 9
  • 45
  • 80
2
votes
2 answers

view.layer drawInContext:UIGraphicsGetCurrentContext() not drawing

I am trying to draw a UIView into a UIImage. Here is the code that I'm using: UIGraphicsBeginImageContextWithOptions(myView.bounds.size, YES, 0.f); [myView.layer drawInContext:UIGraphicsGetCurrentContext()]; UIImage *img =…
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
2
votes
1 answer

Printing shinobi chart into PDF

I have several shinobicharts in my App that I want to print into a PDF file. Everything else, like normal views, labels and images work fine, even the grid, legend and gridlabels are displayed. The only thing missing are the series. So basically I…
daydr3amer
  • 326
  • 2
  • 19
2
votes
2 answers

CGImageRef consumes lot of memory

I am creating blur image for one of my apps screen, for this i am using following code UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image =…
Shankar BS
  • 8,394
  • 6
  • 41
  • 53
2
votes
1 answer

CALayer renderInContext iOS7

I'm rendering multiple layers to get one final image. One of the images contains a face, and another one contains a background with a transparent gradient around the face so that the real background is hidden. In iOS6 it works perfectly but it is…
user1523341
2
votes
1 answer

How to get the screenshot when a view controller is presented over another view controller?

I want to get the screen shot of the current screen. But whenever MFMailComposeViewController or any other view controller is presented, the screenshot drawn doesnot has a black screen. //Code to draw what ever is present currently on the screen -…
user1899840
  • 543
  • 2
  • 7
  • 19
2
votes
1 answer

Memory increasing by 20 MB every time i scale the image

I have following method to scale down an image. But Every time i click a picture using my ipad 2 and call this method the Real memory size of the application in instruments goes up up 20 MB. Eventually crashing the application. This method always…
ila
  • 920
  • 12
  • 35
2
votes
1 answer

Capturing an image of one View Controller from another Class

I have one MainViewController, on top of that I am adding a UIView iSnap which is another Class. Now I want to capture a part of MainViewController view in class iSnap. Is it possible ? I know how to capture the image from current View Controller's…
Prashant Nikam
  • 2,253
  • 4
  • 17
  • 29
1
vote
0 answers

Draw rectangle on UIImage after rotating with respect to given center

I want to draw a rotated rectangle on a UIImage where rotation will be based on a given center. My concept is to select starting coordinate of the rectangle first, then calculate the new coordinate of the point after rotation based on the center,…
Jabed Dhali
  • 167
  • 6
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

App Terminates when generating more than 58 PDF pages in a document (Memory Issue?) Swift

I'm creating PDF files on my app, And having a memory issue when merging PDF pages together. After running Instrument Allocations I can see that all the undisposed data is at: private func addPageToMainPdf(left: Bool) -> Bool. The instrument points…
Paul
  • 183
  • 1
  • 12
1
vote
0 answers

how efficiently modify 5000 pixels of big UIImage 60 times per second with Swift

I've got a UIImageView with its image myImage (= big UIImage 2000x2000) I want to modify this image 60 times per second for about 5000 new different pixels each time (they can be everywhere in the image, but are usually in the same area of the image…
Gogo123
  • 655
  • 1
  • 4
  • 11