Template Image doesn't get tinted on Launch Screen Storyboard - ios

I am setting up my launch screen with storyboard, and I'm using an image that is set to be a PDF template image. My goal is to put this image in a UIImageView and set tint color to it via Interface Builder.
This approach works fine if I have such image view in my Main.storyboard, but somehow, on LaunchScreen.storyboard, the image doesn't get tinted and takes on the actual color rendered on the PDF.
I looked around for information online but haven't found much info on proper use of template image on Launch Screen.
Is using tint color supported on Launch Screens? If it is, what's the appropriate way to set it up?

Launch screen storyboards work differently than a general storyboard. They are basically substitutes for launch screen images.
There are some restrictions for them: they cannot run code, nor they can use custom fonts etc. These restrictions include not being able to use tint colors.

Tamás Sengel's answer is partially correct. But for now, you can use tintColor in LaunchStoroboard.
Follow these steps:
Go to Assets.xcassets and set Render parameter of your image to Template Image.
Then add your image and set it tintColor.
Notice that, if it doesn't work, this is not a reason to be upset. Try to reset your emulator by the following way: run Simulator and click Device -> Erase all Content and Settings. Аnd it should work.

In my case, my image wasn't showing at all. So I read about the following trouble shooting hints somewhere:
uncheck Clears Graphics Context in the attributes inspector of the UIImageView in your LaunchScreen.storyboard
delete app
restarting the iPhone/iPad
reinstall the app
try if it worked and repeat all the steps a couple of times until it works :D
After that I had no issues tinting a PDF image asset marked as Render as Template Image in the asset catalog. Tested on iOS 11 and 12.
Unfortunately those caching issues and all the Launchscreen caveats are poorly documented by Apple.

Related

image view only shows background color in launch screen

I'm having some problems with my app's launch screen storyboard.
When I run the app on an iPhone 5S, the image is displayed. However, when I run the app on an iPhone 8, the background color of the UIImageView is shown.
In the project settings, at App Icons and Launch Images, I am not using an image source (although trying do so doesn't seem to work either) and the Launch Screen File is set to LaunchScreen.
The View Controller has Is Initial View Controller checked and the file has Use as Launch Screen checked. The image set was brought in using Import... and is universal.
I've read through several of the solutions for black screen here, but switching the background color revealed that was where my black screen was coming from.
In the assets file, the image set has 1x # 640x1136, 2x # 1242x2208 & 3x # 1125x2436. I experimented with other combinations, but this is the first set that let me see the actual image on the 5S. I'm pretty sure the issue is not having the right configuration of dimensions in the image set file, but can't be certain.
Any help would be much appreciated. Thanks in advance.
Had the same thing. Working on the simulator but didn't work on the device (or any other possible option). It's just a bug.
Try these until it works:
Turn simulator/device off and then on again.
Hard clean simulator. Turn it off.
Clean/Hard Clean/Delete Derived data
Reboot Xcode
Hope one of these helps.
If not, please include the screenshots of working / non-working app screens.

How to setup launch Screen for universal correctly?

I have no idea how to solve my launch screen for iPad. I purposely created a new project which supports for universal. Same image name but it works for new project but my old project its not displaying out. it shows a white blank screen. May I know what is the reason?
Make sure that your LaunchScreen file is selected in the Project General Settings, like so:
Also, if you're using a storyboard for your Launch Screen, make sure there the only view controller is set as initial view controller., like so:
EDIT:
So if restarting the device did not work for you, try the following:
Re-adding the image into your Assets.xcassets.
Renaming the image.
And from this answer, https://stackoverflow.com/a/35481616/3231194, try unchecking the Clears Graphics Context of your UIImageView.
If you're using PNG image, make sure that Alpha is unchecked while saving the image.

Launch screen image not displaying correctly

Working with the iOS launch screen and it's a very painful experience.
Finally got it to appear, but no matter what I do it won't align properly. It's either stretched too far, or in a weird position off the screen.
What values for mode and stretching should I use to display this image viewer in my .xib?
If you're using the Launch Screen.xib or Launch Screen.storyboard, you need to set the correct AutoLayout constraint in your IB file.
If you're not, you need to set the Launch Images Source in your project general settings page.

Xamarin.Forms ContentPage.BackgroundImage

Xamarin.Forms
VS2013 IDE
I know there are other topics on this, but they don't answer my problem.
For Android, the background image works fine.
BackgroundImage = Device.OnPlatform("Resources/HTbg#2x.png",
"Drawable/HTMobile.png",
"Images/HTMobile.png");
For iOS, I can't get it to work.
I've tried the normal and retina versions of the image, which are of
the correct dimensions for those screens.
I've tried placing them in the root folder of the project
I've tried images with transparent or solid colored image backgrounds
In iOS, the background image, in any of the scenarios above, just shows a white screen ontop of all the CustomContentPage controls. I comment out the background line of code, and my page shows normally, with all controls and navigations links...
With the following code (no 'Resouces' folder), the page shows normally, but no image...
BackgroundImage = Device.OnPlatform("HTbg#2x.png",
"Drawable/HTMobile.png",
"Images/HTMobile.png");
How do you set the background image in iOS?
For this answer, I need to know the following:
Where do you put the image in the project so it's picked up properly?
What type of image do you use? Size? Resolution? Color depth? Transparency?
How do you let iOS 'know' what image to use if it's a 4s, 5s or 6/6+ iPhone?
EDIT
ContentPage.BackgroundImage is of type FileImageSource - meaning the correct resolution is loaded automatically; therefore the call should be...
BackgroundImage = Device.OnPlatform("HTbg.png",
"Drawable/HTMobile.png",
"Images/HTMobile.png");
But this still doesn't work. I'll add in the 4-inch image version and see if that helps...
This problem on IOS is solved by adding the required image to an IOS asset catalog. Xamarin.Forms WILL NOT load an image into the BackgroundImage property when it is located in the Resources folder as for versions of IOS pre 7. This might save someone some time.

Xcode 5 slice image from images.xcassets, correctly stretched in xib, but not at runtime

I've got this issue. In my app I use different "universal" graphical assets.
Those assets are used as background image mostly and need to be stretched or tiled.
After the process of slicing in the Images.xcassets I can see them drawing correctly in xib and storyboard, but when I launch the app in the simulator, corner edges are deformed.
Here some screens:
From Storyboard it preserves the slicing selection:
Settings in the Images.xcassets:
Running app result:
Has someone seen this issue?
Found the issue, slicing images using the Xcode interface works only if the deploy is >=7. If you deploy on lower it just disable that functionality, displaying also a warning while building.

Resources