Tag: imagenamed

(iPhone) Use external image in UIImage imageNamed

I am downloading two images from the web Apple.png and Apple@2x.png. I want to use [UIImage imageNamed:@”Apple.png”] so it can use the build in features to detect whether it should display either Apple.png or Apple@2x.png. Now where do i store these images? I read the following in the documentation: The name of the file. If […]

Loading NSImage with imageNamed from xcassets crash in older osx versions

So, I have an xcassets that is shared amongst quite a few apps. I’m developing with Xcode8 in a Mac Mini with MacOs Sierra installed in it. If I compile and run in the development machine, there’s no issue at all. However, when I try to run it in a device with OSX Mavericks I […]

UIImage initWithContentsOfFile doesn't work

I have question: I want to avoid [UIImage imageNamed:]. So i did: UIImage *prodImg = [[UIImage alloc] initWithContentsOfFile:@”myimage.png”]; controller.productImg.image = prodImg; [prodImg release]; But now the image is not shown anymore. Does anyone know how to get that to work?

JPG image doesn't load with UIImage imageNamed

I read on the reference that from iOS version 4.+ with the method imageNamed of UIImage object, the file extension is not required. From UIImage class reference: Special Considerations. On iOS 4 and later, the name of the file is not required to specify the filename extension. Prior to iOS 4, you must specify the […]

UIImage imageNamed returns nil

I am pretty new to iOS and Xcode. I tried to load an image with [UIImage imageNamed:@”imageName.png/jpg and so on”]; but it only returns nil. The image should be in my project bundle, considering the fact that I can choose it from drag and drop menus in the InterfaceBuilder and it was added to Xcode […]