-[UIImage imageNamed:]
does not accept a full path to the image file - it only accepts a filename and then looks for an image with that filename in the application's main bundle. That's why it returns nil. -[UIImage imageWithContentsOfFile:]
, on the other hand, expects a full or partial path to the file. The major difference between the two constructors is that imageNamed: caches the image internally (in a private cache specific to UIImage), whereas imageWithContentsOfFile: will not cache the image.
Sidenote: No, that's not a memory leak. You're using a convenience constructor which according to the memory management rules for Cocoa should return an autoreleased object that you do not take ownership of unless you explicitly retain it elsewhere.