Duplicate images in my assets.car - ios

So I was snooping around in that achieve trying to make my app smaller. And I found something odd!
There are two identical copies of every image! One with an ending "~iPad" and one with "~iPad#2x"
I understand the purpose of having those two endings, but when I am setting up the .xcassets the way I am.... I don't expect the app to need it. Is there any way to get rid of the duplicate?
Here is how I have set up one of my entires:

You should use universal image asset instead of separate for iphone and ipad.
from assets select this image set and from attribute inspector uncheck iphone and ipad under Device and check universal from it.
So you will get universal imageset with 1x,2x and 3x will automatically used by iphone and ipad both.
If you are using different size of images for iphone and ipad then you must set separate images for iphone and ipad but if you are using same image size then you should use universal as i mentioned above.
Hope this will help :)

Related

How to add iPad and iPhone assets quickly?

When I import an image, it gets placed in "Universal". Is there a way to tell xCode directly that that image is designed for iPad at #2x, and that image is designed for iPhone at #3x, and put those 2 together if they have the same name? Now I need to add everything manually, which takes a long time...
Thanks.
Edit: further detail (cause I probably misread your question a little)...
Xcode should already be doing that for you... I just tried it:
cat#2x.png
cat#3x.png
cat#2x~ipad.png
Select all three, drag and drop them into Assets in Xcode, and I automatically have a resource named "cat" with both 2x and 3x iPhone versions and a 2x iPad version.

iOS: UI Assets missing options and sizes

I'm trying to create an new asset catalog for universal project (iPhone and iPad). I add new xcassest:
But As you can see in case of iPhone only shows one option for 2x. In my case I need to add backgrounds and for both 4-4s and 5-5s phones the images are 2x also is not showing an option for the 6/7 and is also 2x.
My question to guys is how can add the assets for every screen size in my xcassest file.
I'll really appreciate your help.
Nothing is "missing". Screens can come in different resolutions, and all possibilities appear in the screen shot. So every image in your app will come in three versions, and slots are provided for all of them. (You should use "Universal" unless the images for iPhone and iPad are truly different from one another, i.e. different content.)
As for image size, just use a size that works with the largest screen and permit the image view to scale it down as needed (or, for less memory waste, scale it down in code yourself at runtime).

Xamarin Image Assets for Size Classes

I am building an universal Xamarin application for iOS. I am working on the launch screen, and trying to use size classes to modify the layout for iPhone and iPad devices. The positioning works correctly, but when I try to set the image assets things go wrong.
I am trying to use the size class feature on the XCAssets file within Xcode to set the correct image I want for the different screen sizes. I have an image set for [any, any] ([,]) for the iPhone, and then I have one set for the [regular, regular] ([+, +]) for the iPad.
In Xcode's interface builder I can see the correct image in my launch xib file when switching between the [any, any] and [regular, regular] size classes. However, when I run this in my iPad simulator I do not see any images at all. Note that when I run the app in my iPhone simulator the [any, any] images are picked up correctly. It's only when running on my iPad simulator things go wrong.
I have resorted to using Xcode's tools as I cannot find a way within Xamarin to get images within a single image set for different size classes. I believe the issue I'm running into must be an issue within Xamarin not respecting the properties set in Xcode.
My question is has anyone been able to get this to work on Xamarin, and if so how?
Thanks!
Ok, so I found the solution. It appears to in fact be a bug within Xamarin and has todo with Xamarin not always updating the XIB files correctly.
Firstly, do not use the size class options inside of the XCAsset file within Xcode. Simply use the Xamarin version of the tool, and set the iPhone and iPad variations of the image set. I used the naming scheme [image_name][#2x|3x].[ext] for iPhone graphics and the scheme [image_name]~ipad[#2x|3x].[ext] for the iPad variants. However, keep in mind that according to the Apple documentation when you use size classes the ~ipad suffix is ignored. I simply use this suffix to make the file names unique between iPhone and iPad.
Second, go ahead and use size classes as you wish, but do not worry about changing the graphic name, and do not worry about the fact that you will not see an image preview when in the [regular, regular] class.
Third, before running the app use the Xamarin clean command at least once, but sometimes it takes a couple of attempts to fully clean the solution.
After theses steps the image assets worked for me for the iPad via [regular, regular] size class. I know it seems hacky, and may not be the "Xamarin" or "Apple" way of doing things, but it works.
Hope this helps someone else not spend two hours of their life dealing with Xamarin's short comings :)

Does the iPhone 5's screen require separate versions of my app's images?

I have a graphic designer that creates images and things like that for me. Do I need give him separate image sizes to be created specifically for iPhone 5, or do I build like I used to for the 3.5 inch screen? Will the images be resized automatically?
Here is one link that may help you.
Naming convention for iPhone 5 images?
and heres another
Screen size of iphone 5
Reviewing these links basically evaluates to yes you have to create separate images for iPhone 5 you will need to add -568h#2x.png to the end of each image that is for iPhone 5. You need to also create and set the launch image as well called Default-568h#2x.png are it will not pick anything up for the iPhone 5.
No it will not resize the images automatically it will select the correct image to use, it will select the one with the -568h#2x.png simple as that.
Hope this helps.
You have to provide specific files if your images are dependent on the screen ratio.
In order to conditionally use an image according to the device you can use the technique shown here.
If that's not the case, simply provide the same images and adjust the layout programmatically or within Interface Builder.
No iOS devices with a retina display can run iOS 3. You will need high resolution versions of all your pictures.
As for converting photos to work with the iPhone 5, it depends on the photo and how it's used. If the image is used as part of the background, you have two options: you can tile it, which would not require new pictures, or you will have to redesign it altogether.
As for the other pictures, whether you can work with the same ones (same size or resized) or need new ones depends on user interface decisions only you can make. If an image must retain a certain ratio, then perhaps you can resize it and place it accordingly, or maybe an entire new image would work better.

iPad Retina Images not showing?

In my application, I am having trouble showing iPad Retina images. I know I have to use the #2x~ipad.png extension in order to get them to properly show and I do that. My images are named according so they are all named the same besides the extension for each device. However, my images appear blurry when viewing them on an iPad 3. I know the images are the proper size and PPI but it just doesn't look clear.
My images are in my 'Copy Bundle Resources' too. I have tried to clean my project, and restart Xcode. No luck.
Also in Interace Builder in my iPad XIB, I have each image set to the -72.png image (I guess the image automatically switches to the #2x~ipad.png if it is an iPad 3 correct?)
Is there any way to confirm maybe via NSLogs to see if it is loading the correct images? Also is there anything else I should double check to ensure that the proper images are loaded.
Uh, if you really are doing this:
[name]-72.png and [name]#2x~ipad.png
thats not right.
If this is a universal app, then you have
Foo.png (or Foo~iphone.png) and Foo#2x.png (or Foo#2x~iphone.png) [NOTE: iphone not iPhone];
Foo~ipad.png and Foo#2x~ipad.png
This all working for me in my universal app.
EDIT: you can read about the naming convention in Apple's "Resource Programming Guide", page 46:
The bundle- and image-loading routines automatically look for image
files with the #2x string when the underlying device has a
high-resolution screen. If you combine the #2x string with other
modifiers, the #2x string should come before any device modifiers but
after all other modifiers, such as launch orientation or URL scheme
modifiers. For example:
MyImage.png - Default version of an image
resource.
MyImage#2x.png - High-resolution version of an image
resource for devices with Retina displays.
MyImage~iphone.png -
Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png -
High-resolution version of an image for iPhone and iPod touch devices
with Retina displays.
EDIT2: So I did trip on a reference to "-72" (and -50). These were used in iOS 3.1.3 and older. The full explanation is found "iOS Application Programming Guide", "App Icon" section (links too fragile to use).
What I am doing is setting the image names to:
[name]_ipad.png, [name]_ipad#2x.png. [iPad]
[name]_ipod.png, [name]_ipod#2x.png. [iPhone]
And, I added a category on UIImage, mc_imageNamed: that appends the _ipad or _ipod based on the current device. And of course I have set the images based on their names in the XIBs.
This method is guaranteed to work, from my experience. It would be great if someone would fix your issue, but this solution is also available.

Resources