Launch Screen Localized Image not rendering - swift

Problem: The Launch Screen Image is either not rendering (white space where UIImage should be), or not being localized.
My project is set up to load the LaunchScreen from Launch.storyboard via the target's General configuration.
Some facts:
XCode 7.3
Multiple Targets with unique Launch.storyboards.
Tried with two images one was a localized Image.png file (in resources, not in .xcassets), the other was 2 unique image sets in
.xcassets one named "image_en" the other "image_fr".
Some things I tried:
Cleaning the project, resetting the simulator, restarting xcode,
deleting the app's DerivedData.
Created a new Master-Detail project and localized the LaunchScreen.storyboard file. Then added
image_en in en.lproj/LaunchScreen.storyboard and replaced the image
in the fr.lproj/LaunchScreen.storyboard with image_fr .xcassets files
this solved the image not loading problem, but the image was still
not localized.
Created a new Master-Detail project and localized the LaunchScreen.storyboard file. Then I localized the Image.png and added it to the LaunchScreen. This image appeared, but wasn't localized.
Question: Why is a black void appearing in the Launch Screen localized Image.png in my original project? && is this an xcode bug or am I doing something wrong?

Related

Why image not shown in simulator when using XIB designable?

Currently i'm trying to change icon image from designables image
I have main project with bundle com.abc.def (firstbundle)
I put the image on another bundle com.abc.ghi (another framework connected to main project)
When i set the image on viewcontroller (in the first bundle), the image shown in the interface builder. (2nd image)
But when i run it on simulator, the image is not shown. And there is error in console
Could not load the "hide" image referenced from a nib in the bundle with identifier com.abc.def -> This error means, xcode try to find image from first bundle not from second bundle. How to make it also check image from second bundle ?
The problem is only if i using designable option from XIB. If i'm not using it, just define directly inside source code "remove #IBInspectable from the 1st image" (from another bundle). The image shown correctly

Launch image displaying after deleteing

I deleted launch image from launch image option.Still i am getting launch image?I do not know where it is from loading?
You should change the name of your image as would be defaultly saved as Default.png, As xcode changes the name of the image itself whether you add the name of the image yourself or not.
And as The Dude suggested clean your code and reset your simulator if you are working on it and build your project again , then run and see.

iOS: How to use images in custom bundle in Interface Builder?

I have a bundle where i put images in it.
The contents are:
MyBundle.bundle/images/picture1.png
MyBundle.bundle/images/picture2.png
I dragged MyBundle.bundle into my project.
Now I can see these images in Interface Builder and can even use them. However, when I run the app, I don't see the images.
What's wrong?
Thanks,
Make sure the bundle is getting copied over in the "Build Phases" of the project settings for the target.
Also, try setting them progrmatically and see if they show:
myImageView.image = [UIImage imageNamed:#"MyBundle.bundle/images/picture1.png"];
I just tried this in my project and found that what you need to do is specify the image with the bundle name in front like this:
In the IB the image will look broken:
but when you build and run your project the image will show correctly.
So, in your case, use MyBundle.bundle/images/picture1.png in the actual Interface Builder Image box.
Also, when you dont put the bundle name in front, you get this warning when you load the view with the bundle image:
2011-10-12 08:22:16.360 UTDebug[721:11c03] Could not load the "map.png" image referenced from a nib in the bundle with identifier "com.companyname.myproject"
You need to put the XIB in the bundle, too. When you do that, resources for the interface will be relative to the bundle, so they'll work both in IB and when you load the interface in your app.
You might have a stray build setting from having created the bundle as a Mac OS X target.
See my other answer for the solution.

Localized App Icons with Retina Display for iOS

I have issues showing a localized app icon with retina display support.
How could this be done?
I tried to make Icon.png and Icon#2x.png localized, then I tried to make the proj-Info.plist localized and try to link to different Images.
But only the Icon of the project language are being shown...
You need to create one infoplist.strings file for each of the language. For that, create language.lproj folders manually and put Infoplist.string file in each of the folder.
Inside the file enter the following: CFBundleIconFile="Icon_en.png" or CFBundleIconFile = "Icon_pt.png".

Images in Interface Builder when using MonoTouch

I'm new to MonoTouch and iPhone development. I have my images (PNG) in a resources folder in MonoDevelop, however if I want to set the image property for a button in Interface Builder, how do I do that? It's always a blank dropdown. Do I need to use XCode to access the XIB file and then somehow embed the button image file I'll need in it?
This is a known limitation of MonoDevelop and Interface Builder. To add images to an XIB in Interface Builder they must be part of an XCode project, which of course coming from MonoDevelop they're not.
To achieve what you're trying to do you will need to set the image via code, and ensure the build action of your image is set to Content. To do this, simply right click your image inside MonoDevelop, and select Build Action > Content.
On your view with the button on it, create an outlet in Interface Builder for your button, hook it up, then from code to set your image, you just need to use the .FromFile("path/name") method of UIImage.
UIImage buttonImage = UIImage.FromFile ("resources/image.png");
myButton.SetBackgroundImage (buttonImage,UIControlState.Normal);
That's off the top of my head, but I think that should do it.
You can manually set the image in Interface Builder, but it wont show up until run time. The image name can include a path, e.g. "images/settings.png".
All solutions given here are completely wrong and misleading. All you need to do, is place your images in the Resources folder (on the project root), and add your images to this folder. After adding files to this folder, mark all files and make sure their build action is set to BundleResource.
I also needed this to work, here is a workaround I found.
You need to create a dummy xcode project. Place it in the same folder as your project.
Add all your xib files and image files to that xcode project by dragging them in when the project is opened in xcode. Now you will be able to see the preview of the images.
The image files must be in the same folder as the project file and xcode must be opened with the dummy project while the interface builder is opened.
Not great - but solves the issue for now.
Here is a sample project I have created.
For this issue to be resolved on the MonoDevelop side - some inter-process communication code needs to be created, I think that a good starting point will be looking for "PBXProjectWatcherServerConnection-3.1.2" in google.