Can iPhone directly display vector image files? What formats are supported?

Is it possible to render a vector image file on an iPhone in the same way as a raster image file (png, jpeg) can be made? I tried eps and pdf files, none of which work - they display correctly in Interface Builder, but do not display at startup.

The console displays a message stating "Failed to load the image" image.pdf "referenced by the thread bundled with the identifier" com.yourcompany.project "'

All my searches on this subject discuss drawing vector files using OpenGL, etc. Is this the only way? Since there is no mention of vector file support, I am not sure that my files are not loading due to file problems (I tried different versions) or because they are not supported.

+5
source share
5 answers

You can create PDF images natively and also create them using Core Graphics. Something like that:

void DrawPDF (CGContextRef context, NSString *name)
{
    NSURL *url = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: name ofType: @"pdf"]];

    CGPDFDocumentRef doc = CGPDFDocumentCreateWithURL((CFURLRef)url);
    CGPDFPageRef page = CGPDFDocumentGetPage(doc, 1);

    CGRect box = CGPDFPageGetBoxRect(page, kCGPDFCropBox); //kCGPDFArtBox);
    CGContextDrawPDFPage(context, page);

    CGPDFDocumentRelease(doc);
}

UIWebView, of course, for SVG.

+4
source

, , PNG JPEG. , , .

+2

PDF UIWebView. , Quartz 2D PDF : Quartz2D

+1

, SVG.

SVG javascript , Raphael. -, , - iPhone - -!

+1

You can use something like http://www.codeautomat.com/ to convert SVG files to Core Graphics Objective-C code.

+1
source

All Articles