FAQ Database Discussion Community


Rotate all pages in a PDF graphics context

ios,pdf,cgcontext,airprint,cgcontextdrawpdfpage
I'm creating a PDF file containige multiple pages: NSMutableData *pdfData = [NSMutableData new]; CGRect rect = CGRectMake(0, 0, 300, 100); UIGraphicsBeginPDFContextToData(pdfData, rect, nil); for (NSInteger page = 0; page < 10; page++) { UIGraphicsBeginPDFPage(); // DRAW PAGE } UIGraphicsEndPDFContext(); The PDF will be printed, but always in along the longer...

iOS : Drawing on a CGContext eventually blurs

ios,uiimageview,cgcontext,cgcontextdrawimage
I have a app that displays a document that has a UIImage over the top of it where you can draw lines etc to highlight stuff. If I keep drawing lines (touch, draw, lift finger off, and repeat in a different area of the screen) The lines slowly blur. Here...

Debugging code:: How to colors lines in CGContext?

swift,nsstring,cgcontext,quartz-core
The following code has an problem, for some reason the radial lines are being drawn black when they should be drawn in UIColor.yellowColor() import UIKit import QuartzCore let π:CGFloat = CGFloat(M_PI) class CircularPlotView:UIView { var lineWidth:CGFloat = 1.5 { didSet { setNeedsDisplay() } } var edgeColor:UIColor = UIColor.yellowColor() { didSet...

Capturing screen with mixed view controllers, 3d scene kit, uiwebkit

ios,swift,uiviewcontroller,cgcontext,scenekit
My iPad app can do a screen capture of all view controllers displayed except for a 3d scenekit VC. Here is my code for capturing the screen @IBAction func screenImage(sender: UIBarButtonItem) { //Create the UIImage UIGraphicsBeginImageContext(view.frame.size) view.layer.renderInContext(UIGraphicsGetCurrentContext()) let screenshot: UIImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() //Save it to the camera roll UIImageWriteToSavedPhotosAlbum(screenshot,...

Swift - Using CGContext to draw with finger

ios,swift,uiview,cgcontext
I'm trying to make a drawing app. I have a single custom UIView: class DrawView: UIView { var touch : UITouch! var lastPoint : CGPoint! var currentPoint : CGPoint! override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { touch = touches.first as! UITouch lastPoint = touch.locationInView(self) println(lastPoint) } override func touchesMoved(touches:...

How to draw a triangle shaped UIButton

ios,uibutton,core-graphics,cgcontext
I really dig the IFTTT bottom right corner button, as shown in the image (bottom right). I tried playing around with CGContext and UIBezierPath to match the effect, but i simply don't know enough to get this right. Does anyone have some thoughts/code on how to make this happen? Thanks!...

Having an error when using UIBezierPath

ios,objective-c,cgcontext,uibezierpath
I use UIBezierPath to draw a line. But having an error This is my code: UIBezierPath *aPath = [UIBezierPath bezierPath]; [aPath moveToPoint:CGPointMake(100, 100)]; [aPath addLineToPoint:CGPointMake(200, 200)]; [aPath closePath]; aPath.lineWidth = 5; [[UIColor redColor] setStroke]; [aPath stroke]; This is error: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application,...