Loading images in WatchKit - objective-c

I was loading images as background to a WKInerfaceGroup object using setImageName:. But now, I need to do some treatments to the images before they are actually displayed. So, I am calling +imageName: from UIImage with the same exact name, but the image won't load. Why one method works but the other doesn't?
I am using using Xcode 7 beta 4 and Watch OS 2 simulator.

Moving the images in a xcassettes file solved the issue.

Related

Image size changing from Expo to App Store

When running my application in Expo all images look fine and lovely, it's just when I deploy to the app store suddenly my images are huge.
I made sure that I follow Expo's standard on image spec as written here;
https://docs.expo.io/versions/latest/react-native/images/
Even weirder is the images look fine on iPhone X but the size is off on iPhone 7 (but on that same iPhone 7 in Expo everything looks ok). So just wondering if anyone has experienced any issues going from Expo to App Store with images and if they did how did they solve them?
Note: I am yet to deploy to Google play so haven't been able to see the effects there yet.
All input greatly appreciated
Just try to use WIDTH and HEIGHT from Dimensions
And then set width to your image by multiplication of WIDTH on some coefficient.

Why does iPad preview use wrong image?

My question is, why does the iPad preview use a different image than the storyboard for wRegular hAny?
I'm trying to set up a universal app with a menu that will use larger buttons for iPad. In the asset catalog, I've specified the standard image size for wAny x hAny, and loaded a larger image for wRegular x hAny.
The story board looks fine for all size classes, with the wRegular x hAny using the iPad image, and everything else using the iPhone image. But the previews all use the iPhone image, including the iPad preview, despite the storyboards showing the correct images. In the screen shots below, the story board is shown to the left, preview to the right.
Can someone tell me what I'm doing wrong here? I'm trying to avoid using explicit image sizes for each class - is that what I should be doing?
Any help would be greatly appreciated. I've read everything I can on using different image sizes, and still cannot figure this out.
enter code here
You can't have a different images by size class for the same button in Interface Builder. It looks to me like you set the image of the button to be the iPad one first in Regular/Any, then set the iPhone one afterward in Any/Any which changed what you did in Regular/Any.
In this image, see how the Font has a + symbol to the left of it, but Image doesn't? That's for specifying the value per size class. Since Image doesn't have that, it's not a value saved for the specific size class.

Strange issues with file name and Xcode sim vs. ios device

I just spent a day trying to figure out why some simple code was not loading images from the resources folder. Just for kicks I went into the finder and renamed one of the files to exactly the same name and it loaded. Then I did the others - simply renaming them to the same name. I looked and there weren't any strange characters or whitespace before or after the file name. So now they all load fine into an array in the simulator. But now on my device, they aren't loaded into the array, returning "nil" and are throwing exceptions. I know that ios devices are case sensitive where the sim is not but I checked this and the naming is all fine. The only thing I can think of is that my images are named for retina (#2x~iphone) and my device is not. But I have images named the same way, for retina, and those load fine.
I am using imageWithContentsOfFile to load the images and also getting a memory warning after it tries to load the images. I am not sure if the memory warning is related.
I think the problem might be in your file naming. Remember that you should include both retina and non-retina graphics in your app. Seeing as you added "~iphone" I'm assuming this is a universal application so your images should be named as follows:
myImage~iphone.png
myImage#2x~iphone.png
myImage~ipad.png
myImage#2x~ipad.png
Then in your code you only reference the "myImage" part of the file name so iOS can sort the rest out for you.
For example:
UIImage *image = [UIImage imageNamed:#"myImage"];

Any other Picker controllers than ELCImagePickerController to select multiple images iOS

i have to select multiple images like 100 images from m iPad, if i used ELCImagePickerController my app is crashing because of too many images,
is there any other controller than ELCImagePicker to select multiple images, if so please let me know...
Did you try out:
http://www.binpress.com/app/agimagepickercontroller/784
You can fix this, by commenting this line in ELCImagePickerController.m inside the selectedAssets function.
[workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]] forKey:#"UIImagePickerControllerOriginalImage"];
It creates a UIImage for each asset, which causes low memory crash when it loads a certain number of images.
You can use iOS multiple Image Picker.
iOS 5.0 - 8.2 support
using Photos.framework in iOS 8
iPhone & iPad support

Automatic inclusion of #2x images (retina support)

Can any one tell me code of auto including #2x images if device is switched to iphone 4.
I have searched very far on it, but nothing fruitful is found yet.
I have already included #2x images in my resource file. I want code to write so that images resize and reposition them selves when application is running on iphone 4.
What do you mean by "auto-including" ?
If you have fooBar.png and fooBar#2x.png in your project resource, then when you do :
UIImage * fooBarImg = [UIImage imageNamed:#"fooBar.png"];
It will automatically load fooBar.png if your screen scale is 1.0 (iPhone3G/3GS) or fooBar#2x.png if your screen scale is 2.0 (retina, iPhone 4).
cf UIImage#imageNamed
Just include the #2x with the normal image in your project, the os will get the #2x if needed.
When you refer to an image always refer to the non-#2x image and iOS will get the #2x image on iphone 4 (or ipod) if you take it in your project and add to the target of course.