Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Saturday, June 11, 2011

Show Local Image in UIWebView

In order to load an image from within the app into your UIWebview, the webview needs to have the correct base url.

NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[webView loadHTMLString:htmlString baseURL:baseURL];


With the correct base url, the images can be loaded relatively with:



Or in CSS

.someBG {
    background: url(theImage.png);
}

Source: http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview

Another way to load an image is to convert it to base64 in this post:

http://iphoneincubator.com/blog/windows-views/display-images-in-uiwebview

Thursday, May 5, 2011

How to get the iTunes icon to show up with a Ad hoc build

  1. Create a png or jpg image file that is 512x512
  2. Bring up the Get Info screen (cmd + i)
  3. Find the Name & Extension section
    1. Uncheck the Hide extension
    2. Name the file "iTunesArtwork" (no quotes, case sensitive, no extension)
    3. close the window
  4. Add the file to your project.
  5. Done.
It is very important that the file is named exactly "iTunesArtwork".  In Xcode you should see this exact name with no extensions.

Monday, January 31, 2011

How to Prevent Retina Scaling

I have an app that will receive the correct image size based on what device is being used.  On the iPhone 4 with retina display, this causes a problem when I just use [UIImage imageWithData:imageData].  The image appears twice as large as it should.

The answer is fairly simple.  It involves using a lower level method to get the image:

UIImage *imageToReturn = [UIImage imageWithData:imageData];
    imageToReturn = [UIImage imageWithCGImage:imageToReturn.CGImage scale:2 orientation:imageToReturn.imageOrientation];

Sunday, November 21, 2010

Simulator vs Device - Case Sensitive

On the simulator, if you have an image named "Buy.png", and  you call for the image with "buy.png", the image will show up.

On the device, the image will not show.