add photos to iPhone simulator - ios-simulator

I need than on button click opens iPhone's default album and I'll can chose a photo.
I read a lot about this, but still don't works.
I do the following:
~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/
I'm storing two pictures IMG_0000.JPG (300 on 300 px) and IMG_0000.THM (75 on 75px)
In my app I do the following on button click:
- (IBAction) btnOpenAlbum
{
album = [[UIImagePickerController alloc] init];
album.delegate = self;
album.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController: album animated:YES];
}
I tried also UIImagePickerControllerSourceTypePhotoAlbum and still no photos in album.
AI solved it in such a way:
Opened iPhone simulator.
Drag there photos. And it automatically copy it to folder ~/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE and named them as IMG_0001.PNG IMG_0002.PNG and so on.
After that all works fine, but:
When I tried to copy item directly to that folder, and give them suitable names, iphone didn't recognized them. And also, when I deleted them from that folder and run simulator - photos where on simulator, but in folder they were not.
What it can be? Thanx.

AI solved it in such a way:
Opened iPhone simulator. Drag there photos. And it automatically copy it to folder ~/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE and named them as IMG_0001.PNG IMG_0002.PNG and so on. After that all works fine, but: When I tried to copy item directly to that folder, and give them suitable names, iphone didn't recognized them. And also, when I deleted them from that folder and run simulator - photos where on simulator, but in folder they were not.

Related

How to removed "Unknown" images from Xamarin Forms iOS Asset Catalog

When updating images in an Asset Catalog for a Xamarin Forms iOS app, I sometime end up with extra images showing in the image set and sometimes the correct images are not assigned to the correct #1x, #2x etc. I also get this sometimes when I attempt to merge changes to my images between to versions of my project. I have been unable to clean out these images and there is no option to un-assign when you right click on these images in the asset catalog. Even deleting image set from the asset catalog via the Visual Studio IDE did not seem to work correctly as I then started getting some compile time errors that image files could not be found in the Assets.xcasstes folder. Any ideas how to correctly merge / handle this type of situation? I would prefer not to manually re-update the images in the second versiomn (i.e. branch) of my project.
So using the steps below, I was able to clean things up but it is a very manual process. Still looking for a good way to merge iOS images between branches. The steps below are for VS 2019 on the PC.
FYI - if your project is version controlled, I suggest performing a check in after every change that is made.
Go into the image set that has the 'unknow' images in and unset any
images that are actually set. (You do this by right clicking in the
image and selecting unset from the popup menu.) Save the project /
assets after this has been done.
Once all images have been unset and you only see the 'unknown' images in the image set, select the image set name in the left hand pane and click the delete button near the top left hand area of the asset manager window. Save the project again.
Click on the iOS project in the solution explorer and select the 'Show all files' option in the top tool bar of the solution explorer window. You should now see a folder named Assets.xcassets under your iOS project.
Expand the Assets.xcassets folder and ensure your do not see a folder for the image set you deleted. For example, if you delete an image set named 'help', ensure you do not see a folder named help.imageset under the Assets.xcassets folder. If you do see the folder for the image set you just deleted, you may need to manually go into you file explorer and delete the folder from you disk drive.
Once the folder for the image set no longer exists in Assets.xcassets folder, I highly recommend cleaning your complete project.
Next right click on the iOS project and select 'Unload Project' from the popup menu.
After the project has been unloaded, the XXX.iOS.csproj file (where XXX is the name of your project) should automatically open in the Visual Studio editor. You now need to search this csproj file for all instance of the image set name you deleted and remove any XML entries you find. For example, if I deleted the 'config' image set and I found the following entries in my csproj file, I would delete all the XML entries. NOTE: I can't get the XML to actually display here so I put it in a separate answer so everyone can see it.
IMPORTANT!! - Also - make sure in the folders under Assets.xcassets ensure there is no Images.imageset folder unless you actually use an asset image set named Images. Otherwise delete this folder and ensure the folder / files are not referenced in the iOS.csproj file.
Once you have removed all the entries from images that are no longer part of your asset catalog, save the iOS csproj. Then right mouse button click on the iOS project in your solution and select 'Reload Project'.
You should now be able to re-compile the project with no errors. REMEBER - check-in your project to your version control system frequently and especially at this point.
Now you can go back into you Asset Catalog and re-add the needed image sets.
Everything should work correctly after this point.
So for some reason, I cannot get the XML code I posted above to actually display so I am going to try to post it here.
<ImageAsset Include="Assets.xcassets\config.imageset\config.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\config.imageset\config#2x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\config.imageset\config#3x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\config.imageset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\Images.imageset\qrbuttonlight32.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\Images.imageset\qrbuttonlight64.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\Images.imageset\qrbuttonlight96.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
You need to make sure you delete the complete XML tag - in this case it would be the entire ImageAsset XML node for each file in the config imageset.

JAVA FX ImageView only loads certain images when launched

I'm currently working on a poker application for fun and I've encountered another issue when trying to work with imageviews.
Right now my structure for my images is the following:
JavaFXApplication1\src\images
that "images" folder contains two more folders, one being "cards" and the other "playerImages".
Here is a screenshot of it also:project structure
Currently I am using a document relative path within scene builder to initially load the images for each of the cards and players. for each of the cards, the imagepath initially is "#..\images\cards\back.png" which is set in scenebuilder. this method works perfectly fine when launching the application. however, for the player images next to the cards, i have "#..\images\playerImages\player1.png" for example and this doesnt work for some reason.
In scenebuilder the "player1.png" image shows up where it should, but disappears when i launch everything.
I read through Images not showing on launch by the main, but showed on Scene builder but Im not not sure the solution for that is the same for me, as my images are in my source folder.
I tried using the fx:id and setting the image manually in my controller class, but was receiving an error stating that my input stream was null.
I also tried just adding "player1.png" to my root images folder and using that path, and that still didnt work. yet, when I change the player1 image path to anything in the cards folder it works. I dont understand why it works for the images in the cards folder but not in the playerImages folder. Both of those folders are in the same location.
I apologize if this was already answered somewhere else and i am too oblivious to see it, but any insight into this seemingly simple problem would be greatly appreciated.
if you have a similar project structure:
--main
--java
--src
--resources
--images
--cards
back.png
--players
player1.png
you can set images from resources in your java-code. But you need to use getResources()
For example:
#FXML
private ImageView imageView;
Image image = new Image(getClass().getResourceAsStream("/images/players/player1.png"));
imageView = new ImageView(image);
Of course directory "resources: shuild be marked as resources root

Unable to add an image in the storyboard editor in Visual Studio to create a splash screen for Xamarin.iOS

I'm trying to add a splash screen to an iOS app built using Xamarin.Forms. I'm able to get the splash screen itself to display, but I'm unable to add an image to an ImageView in the storyboard editor.
I can replicate this behavior in a brand-new "Cross Platform" solution, and I'm following the instructions here. Specifically, at step 10 in the instructions, you're supposed to be able to select the image from a dropdown.
If you actually click on the arrow of what only appears to be a dropdown, however, nothing actually "drops down"; instead VS opens an OpenFileDialog entitled "Add Existing Item".
No matter what file I choose, VS only adds it to the project's Resource folder (as a BundleResource), but doesn't change the image in the storyboard at all.
I've tried adding the images to the Asset Catalog as both a Launch Image and a regular Image Set. I've tried typing either a filename or an asset set name into the editable part of the "dropdown"; no luck. I've also tried editing the storyboard XML to add an image= attribute (to the ImageView tag), again using either a filename or an asset set name, but it doesn't work, and subsequent saves from the storyboard editor actually remove the attribute. I also tried explicitly adding the entire "Assets.xcassets" folder to the project, as suggested by one of the answers here.
FWIW, the property labeled "Highlighted", directly under "Image", also has the same behavior. I'm assuming this is a VS bug of some sort; the behavior of the property is different not only from what's described in the docs, but conflicts with the appearance of the control.
Has anyone come across a workaround?
Windows 10 Pro
VS 2017 15.8.3
Xamarin 4.11.0.756
Xamarin Designer 4.14.221
Xamarin.iOS and Xamarin.Mac SDK 11.14.0.13
It is bug, you can voite to this problem https://developercommunity.visualstudio.com/content/problem/319294/xamarinios-cant-select-image-asset-for-image-view.html

Complication placeholder not showing

I've just added a complication to my watchOS app. I was able to select it on simulator's watch face, but it shows blank items. Temporary all methods of CLKComplicationDataSource return nil. I've created a new assets group for complication, added all required .png images as specified here, setup Complication Group property in Xcode target, but nothing shows up!
What should I do to enable static placeholder images for my complications?
Configuration in Xcode:
The problem was that the .xcassets file with placeholder images must be included into the watch extension bundle, but it was included into the watch app instead. I spend all day trying to figure this out.

Retina display images in app?

It was my understanding that all you needed to support retina display was to have a #2x image and scale down to half for the non retina display devices. I put all the regular and #2x files in my Supporting Files > Images folder. However, on the apple website is says the following:
"Even if you use these fixed icon filenames, your app should continue to include the CFBundleIcons or CFBundleIconFiles key in your app’s Info.plist file"
I was unaware that I had to do anything to the plist file or maybe the information in apple's website is outdated. I am running xcode 4.4, any help is appreciated, thanks.
its simple to add icons click on your project in the xcode navigator and just drag and drop the icons to the right slots. then, to be sure they are there just click on the info tab icon files ios5, icon files, ... , and then see if it says icon.png, icon#2x.png, icon-72.png because you need those. its pretty simple and the only editing you really have to do is add icon-72.png(which should be 72x72) and then it should work fine

Resources