Xamarin.iOS: Adding image in visual studio assets.xcassets imageset for both landscape and portrait orienatation - visual-studio

For my Xamarin.iOS project I am using LaunchScreen.Storynboard for showing launch screen. For adding images, I am using asset catalog. My application supports both orientations on iPad. However, when I open imageset in visual studio it shows only one #2x image for iPad which will be occupied by Portrait image. Now, for adding landscape image I have edited its Contents.Json file and added image details there. added image locally and also added its entry in projects .csproject file.
However, when I build and run application its only picking one image and applying it to both the orientations.
e.g. Its picking landscape image and applying it in both landscape and portrait launch screen image. Now, in portrait mode image is showing vertically stretched.
which is causing UI issue.
How to set image for both the orientations in visual studio xcassets imageset?
Any suggestion would be appreciated.
Thank You.

How to set image for both the orientations in visual studio xcassets
imageset?
LaunchImage ImageSet is the old way which has been deprecated, we don't need to set storyboard or xib on Launch Screen, but it is nothing except image. We can't find a way to set LaunchImage ImageSet in the latest Visual-Studio.
Refer: Xcode 11 UILaunchImages has been deprecated, use launch storyboards instead Warning
Now, in portrait mode image is showing vertically stretched. which is
causing UI issue.
You should use auto-layout to layout your image in both landscape and portrait orientation so that it won't be stretched. See document here: Managing Launch Screens with Storyboards
:

Related

iOS XCode launch screen storyboard does not display image from asset catalog when running on device

I'm running into an issue where an iOS app project using Launch Storyboard does not display some images from the asset catalog. But it can display another image in the same image view. This tells me that the image view is set up correctly, and something is wrong with the image itself
How can I understand why my image is not displayed on launch screen when starting app?
I checked the asset catalog membership, and the images are members of the correct target. The image displays in the interface builder preview.
I checked and images are not displayed when saved in either JPG or PNG format.
The image previews fine on Storyboard preview.
I tried using smaller image, so it doesn't seem to be a file size issue.
Does not work on either device or simulator.
This image displays:
This image does not display:

No option for Landscape in iPhone Launch Images

Is landscape splash screen supported in iPhone? I don't see the option like I do with iPad, as such:
That's Visual Studio?
Because I am able to see the iPhone Landscape option in Xamarin Studio.
Try switching on and off the "Assets Catalog" dropdown to see if that helps.
Also if that doesn't work you could change at anytime from Launch image to Launch screen and there you can configure your Storyboard for all different sizes and orientations.
Note: will check later in VS.
You could add them to your assets. I don't think image assets are rendered properly in VS. It doesn't show specialized image for iPhone, iPad, watch etc. Only the generic one.
Another thing you might want to consider is using launch story board and not launch images. That's the new way of doing it or the suggested way by Apple. You have far more control on it.
Customizing launch images - Manual approach
Open LaunchImage.launchimage and change the default launch images with your own using the proper resolution for each image (e.g., Default-568h#2x.png should be 640px x 1136px). If your images have different file names then open Contents.json and change the key filename for each image.
Xcode WYSIWYG approach
Drag and drop your Assets.xcassets into Xcode (7.1 or newer version). In the opened window choose LaunchImage and add the proper image for each iOS version and device. Close Xcode and rebuild your Xamarin app to use the new launch images.
Further info : Human guidelines reference

Image not showing up in iOS simulator

I am currently working on an app in Xcode. I'm having the following problem:
I have created a 60-60 pixel image in Adobe Photoshop with a transparant background. I saved this as an .png file, and added it to the 'Supporting Files' section of Xcode. I created an image view in my Main.storyboard. However, when I run the iOS Simulator, the image doesn't appear. I have tried the same thing with a different .png file that wasn't made with Adobe Photoshop, and this image did appear in the iOS Simulator, so the problem clearly has to do with the image and not with the positioning or coding.
Thanks in advance!

Launch images: Landscape left and landscape right for the iPad and iPad retina?

In regards to launch images in p.list file, how do I get landscape left and landscape right to appear as a 'Resource" for the iPad and iPad retina?
I only see 'Landscape Non-Retina'and 'Landscape Retina'
Take that Xcode screen as a guide to remember the various image variants to include but lacks all the rotation possibilities.
iOS looks for an image to display as startup image based on it's name.
If it can not find a suitable file, iOS implements a fallback system looking for another image that can be eligible (always by name).
If none valid image is found simply displays a black screen.
The images files must be PNGs and included in the App Bundle.
The naming scheme is:
<basename><usage_specific_modifiers><scale_modifier><device_modifier>.png
"Basename": can be "Default" or specified in app's Info.plist as value of key UILaunchImageFile
"usage_specific_modifiers" PortraitUpsideDown, LandscapeLeft, etc.
"scale_modifier": none or #2x (for retina)
"device_modifier": -ipad or -iphone
You can find all the details here:
iOS App Programming Guide - App Launch (Default) Images

#2x images do not display in XCode4 interface builder designer

I'm trying to design a xib using XCode4, but when I put down an image view that displays an #2x image xcode doesn't preview it correctly (it displays a missing image icon).
It works correctly when the app is run though.
As an example: I add a UIImageView to my view and set the image property to test.png.
In my project I add a file named test#2x.png.
In XCode 3.2 this image would have correctly displayed in IB, and the #2x version would have automatically half-sized on non-retina devices.
However in IB in XCode4 the image does not display.
Is anyone else experiencing this? If they are, it's a pretty massive issue.
Why not just add both images? AFAIK UIImage isn’t guaranteed to work like that.
I always use both sizes, having the #2x ones first, and unretining them using the free app unretiner from app store, and drop both sizes to the project. When referring to an image, instead of writing test.png or test#2x.png, I write test and xCode finds sizes to the corresponding devices, but YES! in IB, the image won't be displayed in this way, just a question marked blue screen; but that works fine when running the app.

Resources