quartz-2d

How to search text in pdf document with quartz

吃可爱长大的小学妹 提交于 2019-12-02 21:28:03
I'm using quartz to display pdf. I need to get the indexes of pages where my searching text exists. Anyone can help me? Thanks. Solution: There is a sample of code that extracts a text from the page and check it for the sequences. #import <Foundation/Foundation.h> @interface PDFSearcher : NSObject { CGPDFOperatorTableRef table; NSMutableString *currentData; } @property (nonatomic, retain) NSMutableString * currentData; -(id)init; -(BOOL)page:(CGPDFPageRef)inPage containsString:(NSString *)inSearchString; @end #import "PDFSearcher.h" @implementation PDFSearcher @synthesize currentData; void

Drawing triangle/arrow on a line with CGContext

▼魔方 西西 提交于 2019-12-02 19:38:41
I am using the framework of route-me for working with locations. In this code the path between two markers(points) will be drawn as a line. My Question: "What code should I add if I want to add an arrow in the middle(or top) of the line, so that it points the direction" Thanks - (void)drawInContext:(CGContextRef)theContext { renderedScale = [contents metersPerPixel]; float scale = 1.0f / [contents metersPerPixel]; float scaledLineWidth = lineWidth; if(!scaleLineWidth) { scaledLineWidth *= renderedScale; } //NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);

Recreate Siri Button Glow Animation

拟墨画扇 提交于 2019-12-02 18:53:52
Is there any way of duplication the siri button glow animation? It looks absolutely gorgeous, but I have no idea at the moment how to start... are there online preformatted pngs that are rotated? or is it done with CoreAnimation? I believe that Siri animation is made with CAEmitterLayer and CAEmitterCell and then animated with core animation, but I might be totally wrong. Here's some code that imitates the effect: // create emitter layer self.emitterLayer = [CAEmitterLayer layer]; self.emitterLayer.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height); self

3d text effect in iOS

两盒软妹~` 提交于 2019-12-02 14:19:27
I want to render some text on one of my screens that has a 3dish look to it. I am using UIKit and standard views controllers etc. The effect will look something like this: Can this be done somehow with UIKit & iOS? Ordinarily I would just use a static png however, the text is dynamic and updates based on user data The following code might not be perfect, but it should be a good starting point. Basically you draw the font twice, slightly changing the size and the offset. Depending on the font and size you're dealing with you're probably have to play a bit with fontSize , fontSizeDelta and

Quartz PDF API Causing Out of Memory Crashes

夙愿已清 提交于 2019-12-02 01:21:44
I'm having crashing issues using the Quartz PDF API for iOS. At the moment I am compiling with the SDK 4.0 GM Seed and running on my 3.2 iPad (I have tried using the 3.2 SDK with identical results). All the code I am using is based on the standard Apple Quartz documentation and from various sources around the internets. So I can't image I'm doing something drastically different or wrong. The code runs perfectly in the Simulator (all versions, it's a Universal app) and even while using the "Simulate Memory Warning" function. I've used the Leaks tool and there are no leaks that it finds. Build

Alpha Detection in Layer OK on Simulator, not iPhone

↘锁芯ラ 提交于 2019-12-01 10:22:50
问题 First, check out this very handy extension to CALayer from elsewhere on SO. It helps you determine if a point in a layer's contents-assigned CGImageRef is or isn't transparent. n.b.: There is no guarantee about a layer's contents being representable or responding as if it was a CGImageRef . (This can have implications for broader use of the extension referenced above, granted.) In my case, however, I know that the layers I'm testing have contents that were assigned a CGImageRef . (Hopefully

Reduce pdf size - Objective c

南楼画角 提交于 2019-12-01 09:25:52
I have a pdf generation project, it consist of some texts and an image which is already stored in db, i want to preview and mail the pdf generated, everything is ok when there is only text data. Problem arises if there is image in our data. The mail receives the pdf of size 10MB or above even if it have image of size 1MB or below.It is working fine in simulator.My code to draw image is shown below: UIImage *plotImage=[[UIImage alloc]initWithContentsOfFile:[localPictureArray objectAtIndex:i]]; CGSize imageSize=plotImage.size; CGFloat scaleFactor = 1.0; if (imageSize.height>(maxHeight

Reduce pdf size - Objective c

佐手、 提交于 2019-12-01 06:27:49
问题 I have a pdf generation project, it consist of some texts and an image which is already stored in db, i want to preview and mail the pdf generated, everything is ok when there is only text data. Problem arises if there is image in our data. The mail receives the pdf of size 10MB or above even if it have image of size 1MB or below.It is working fine in simulator.My code to draw image is shown below: UIImage *plotImage=[[UIImage alloc]initWithContentsOfFile:[localPictureArray objectAtIndex:i]];

How do I programmatically provide a glossy look to UIButtons?

馋奶兔 提交于 2019-11-30 23:14:54
I would like to add 3D or glossy look to some iPhone UIButtons, but do so without the use of PNGs or stretchable images. I have a lot of buttons of varying shapes and sizes with lots of colors which are generated on the fly, so prerendered images are not feasible in my case. How would you go about drawing the gloss on these buttons programmatically? Brad Larson In this answer , I provide some code for drawing a gloss gradient over a UIView, but Mirko's answer to that same question shows a more performant way of doing this. I created a more elaborate 3-D button style, with gloss and shadowing,

How do I programmatically provide a glossy look to UIButtons?

淺唱寂寞╮ 提交于 2019-11-30 18:04:40
问题 I would like to add 3D or glossy look to some iPhone UIButtons, but do so without the use of PNGs or stretchable images. I have a lot of buttons of varying shapes and sizes with lots of colors which are generated on the fly, so prerendered images are not feasible in my case. How would you go about drawing the gloss on these buttons programmatically? 回答1: In this answer, I provide some code for drawing a gloss gradient over a UIView, but Mirko's answer to that same question shows a more