Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1035145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:30:06+00:00 2026-05-16T14:30:06+00:00

Currently implementing vectorial interface elements on iOS is very peculiar, UIImage advertises support only

  • 0

Currently implementing vectorial interface elements on iOS is very peculiar, UIImage advertises support only for raster formats but i am able to set a pdf file as the image of a UIButton in IB here and it renders with good antialiasing, however the image is not visible on either iphone or ipad running iOS 4.x and 3.x, the only way to have it show is to recreate the same button in code and leave out the .pdf extension :

searchButton = [UIButton buttonWithType:UIButtonTypeCustom];
[searchButton setImage:[UIImage imageNamed:@"search"] forState:UIControlStateNormal];
[self.view addSubview:searchButton]; 

However this only shows the image on iOS 4.x and with considerable resize pixelation and no antialiasing as illustrated:

alt text

Besides the obvious questions of why it looks this bad, why it only works in 4.x, and why the IB version does not work at all, does anyone know any ways to properly user vectorial art in apps?

It does not have to be necessarily PDF but I have seen Apple use that a lot on the mac side apps, both the code and IB approaches above work perfectly on OSX apps BTW.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:30:06+00:00Added an answer on May 16, 2026 at 2:30 pm

    As iOS misses the PDFKit.framework i guess that the issue with the limited/broken PDF support of UIImage is that it is not supposed to have any support in the first place, in that respect i have reported the limited support it has as a bug (rdar:8338627) and it is a bug in IB too with the rendering support being probably carried over from osx.

    I have settled to just rendering the pdf manually in a context then saving that to a UIImage, the code for which is below (tested on iOS 3.x and 4.x)

    #include <dlfcn.h>
    
    -(UIImage *)UIImageFromPDF:(NSString*)fileName size:(CGSize)size{
        CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), (CFStringRef)fileName, NULL, NULL);  
        if (pdfURL) {       
            CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL(pdfURL);
            CFRelease(pdfURL);  
            //create context with scaling 0.0 as to get the main screen's if iOS4+
            if (dlsym(RTLD_DEFAULT,"UIGraphicsBeginImageContextWithOptions") == NULL) {
                UIGraphicsBeginImageContext(size);      
            }else {
                UIGraphicsBeginImageContextWithOptions(size,NO,0.0);        
            }
            CGContextRef context = UIGraphicsGetCurrentContext();       
            //translate the content
            CGContextTranslateCTM(context, 0.0, size.height);   
            CGContextScaleCTM(context, 1.0, -1.0);      
            CGContextSaveGState(context);   
            //scale to our desired size
            CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
            CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, CGRectMake(0, 0, size.width, size.height), 0, true);
            CGContextConcatCTM(context, pdfTransform);
            CGContextDrawPDFPage(context, page);    
            CGContextRestoreGState(context);
            //return autoreleased UIImage
            UIImage *ret = UIGraphicsGetImageFromCurrentImageContext();     
            UIGraphicsEndImageContext();
            CGPDFDocumentRelease(pdf);      
            return ret;     
        }else {
            NSLog(@"Could not load %@",fileName);
        }
        return nil; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently implementing a very complex tree structure to allow for near-instant data access,
I'm currently implementing a histogram that will show a very large scale data using
Hello everyone I'm currently implementing a simple programming language for learning experience but I'm
I'm currently implementing a historical report store where users will store only 1 report
I'm currently implementing memcached into my service but what keeps cropping up is the
I am currently implementing the INotifyCollectionChanged interface for a collection with generally quite critical
I'm currently implementing the OpenNTF Multiple File Uploader by Mark Leusink. This very nice
I'm currently implementing a non-renewable in-app purchase and am a little concerned over the
I'm currently implementing a JavaScript library that keeps track of the history of changes
We are currently implementing MOSS 2007 to replace an older portal system (Plumtree) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.