Image names from assets catalog is not showing up in auto completion - xcode 12 - swift

I am trying to set UIColor from image pattern. But I am unable to access the image set by name in xcode 12.
I saved the image set by "BMW" name. I want If I write BMW it should pre-populate in suggestion and small image of BMW should shown up.
I tried to set like this -
node.geometry?.firstMaterial?.diffuse.contents = #imageLiteral(resourceName: "Earth Day")
But it is showing up as
node image

I got it now.
Although images names are still not pre populating, but we can pick the images from assets by typing #imageLiteral() and double click on it, one popup will open that lets you pick any image from assets.

Use UIImage(named:"BMW") to access the image from your assets folder

Related

how to load an image to the playground

In the playground app, I am trying to upload an image, I google it and many solutions said that I need to put my image to resources. But the case is that in the new playground app, the is no resources folder that's why I couldn't add my image. There are shared Sources and Xcode sources but in these files, I couldn't put my image.
this can be an easy question but the case that I struggle with. And in order to continue my project, this point madden me. Thanks
as you can see, there aren't resources that ı could put my image
there is space for adding an image but in this case, the problem is that after ı chose my image nothing happened
UIImage can be loaded to the Playground app like this,
File --> New Blank Playground.
Click on the '+" icon on the top right corner and choose the picture by clicking Insert from... option.
Load the image with its name from the Playground.
UIImage(named: "test.png")
Output with loaded image

How do I call images from xcassets?

How can I call an image that I have saved in the xcassets folder?
I'm using ARKit. I'd like to make an "Earth" figure by wrapping an "Earth" skin around a spherical node. I can assign a color to it, like so:
earth.geometry?.firstMaterial?.diffuse.contents = UIColor.blue
But I'm unable to assign textures using either:
earth.geometry?.firstMaterial?.diffuse.contents = "#imageLiteral(resourceName:8k_earth_daymap)
or
earth.geometry?.firstMaterial?.diffuse.contents = UIImage(named:"8k_earth_daymap.jpg")
Am I using the wrong commands? It seems like Xcode does not recognize the 8k_earth_daymap.jpg file I have saved locally in xcassets...
earth.geometry?.firstMaterial?.diffuse.contents = "#imageLiteral(resourceName:8k_earth_daymap) is not real code; there is an extra quotation mark, so this wouldn't compile.
earth.geometry?.firstMaterial?.diffuse.contents = UIImage(named:"8k_earth_daymap.jpg") is wrong, because .jpg would not be part of the name of an image set.
Finally, the phrase "that I have saved in the xcassets folder" is worrisome. You must not put anything manually into the xcassets folder. You must let Xcode do that. You simply edit the asset catalog in the project navigator and work by way of Xcode's asset catalog editor window. If you're not working through this window, you're doing it wrong:
Thank you, #matt. Your suggestion helped. I was adding the jpg extension when it was not needed. I was also calling the image using an Image Literal, but for some reason, it did not work. I was able to call the image using UIImage.

CQ5 DAM asset: Not able to create thumbnail at renditions tab

When I upload an image to the DAM and generate renditions, I sometimes find that rendition's thumbnail is not able to be created.
I tried to take a look at http://localhost:4502/etc/workflow/models/dam/update_asset.html but I don't know which step generate the rendition's thumbnails. Is it possible to fix this?
The "Thumbnail creation" process step (part of the http://localhost:4502/cf#/etc/workflow/models/dam/update_asset.html) creates the thumbnail renditions of the uploaded Digital asset in DAM.
Its common to see that the original document does not have a thumbnail displayed in the DAM renditions console. As long as you are able to open up and view the original version of the document and the renditions in their respective consoles in DAM, I think you are good to go!
If you click on the original rendition, the file will open without any issue.
In order to avoid long loading times, if the image is more than 300KB of size then the document icon is shown instead of a full image in case of original rendition. Try uploading a file of less than 300KB in size and you can see the thumbnail in case of original rendition as well.
The rendition is getting generated fine, it is just not displayed on the UI. AEM 6 will be touch UI enabled and in the new UI, you will be able to see the rendition for "original" image as well.

Could not load the "" image referenced from a nib

I have no images called "" (nothing). I've gone through the .xib file of the screen where this pops up and can't find anything that would cause this. Anybody who have had the same issue? Here is the full warning:
Could not load the "" image referenced from a nib in the bundle with
identifier "com.blah.Blah"
You can do this to check it from your storyboard, or nib.
Open it as Source Code:
Then "Find" the image name in it, see if it exists but already invalid in your project, probably you have deleted or changed its name, and now it doesn't seem valid.
I had the same issue and in my case there was an UIButton with an invalid image reference in the storyboard file. The reference wasn't empty so it was not trivial to spot by just searching for "" in the storyboard file. However, Xcode did show "Unknown image" for the button in the Background field instead of "Default Background Image". In the storyboard file it appeared as
<state key="normal" title="Use" backgroundImage="0E39AEA8-7F29-40B2-96B1-63B99047E8D5">
so perhaps grepping for backgroundImage and looking for non-familiar references will help find the cause.
I had this warning because of a UITabBarItem. In the attributes inspector for the field "Selected Image" I had a file listed that was also the value for the field "Image". Nevertheless, I received warnings until I made the "Selected Image" field blank.
Just for reference, this problem is also caused by using .jpg images and referencing them inside of storyboards/nibs. iOS 8 appears to be able to handle the proper type checking between jpg and png images at runtime. However, on iOS 7 and below you will need to manually set the image in the code and remove the image reference inside of the storyboard to get rid of the warning.
Remember you need to manually set the .jpg when referencing jpg images.
[self.imageView setImage:[UIImage imageNamed:#"yourImage.jpg"]];
I came looking for the answer. I searched my entire project and storyboard source code for "" and nowhere could I find it. The clue that the view that is displayed when the error appears is the one you need.
Open your xib or storyboard selecting the relevant viewController.
On the left click all grey arrows to expand the selection in your
view
look for the UIImageView icon (its the one with the palm tree)
select it and open the "Attributes inspector" on the right hand side.
In the ImageView section at the top in either or both Image and
Highlighted you will see greyed out "unknown image".
Use the drop down menu to change this from "unknown image" and build
run
voila
The nib (or ultimately the xib) that is the cause of the warning message is the one that is loaded when the message gets written. You then can look at the controls that use images in the inspector and find one where the image name is "Unknown image". You can then clear this value by setting it to some value and then clearing out the value. Note that with UIButton you'll need to try the four different values of "State Config" (Default, Highlighted, Selected & Disabled) to see where the invalid reference might be hiding.
In my case it was Unknown image in UIBarButtonItem in storyboard.
Very simple remove the image that is not displaying from you project and then clean the project by going to Product--> clean then once again put the image into your project and done. this worked for me.
In xcode 5.1 I had this same issue. The only way I could finally get it to work when using storyboard was to add the images as an image asset catalog. From what I read maybe they changed something in 5.1. I thought that storyboards don't have nibs - so it would make sense that asset catalog replaces the old method.
Project > General > App Icon Arrow > Import New Folder.
As soon as I did that the NIB references went away and my images showed up.
I'm using Asset Catalog on Xcode 6. Simply removing and re-adding the Asset Catalog fix the problem
in my situation, in my xib file,I had ever setup image name for some UIButton and UIImageView ,and delete these image name after sometime, but for unknown reason, these image still apear in the Interface Builder Editer, finally I reset these image name with any image name and delete them again,now problem resolved.
This worked for me:
1- Quit Xcode
2- Make a copy of your .storyboard for backup.
3- Open your .storyboard in a text editor and delete image nodes and image node attributes with empty references.
delete node like this --> <image name=" " .../>
delete image attributes like this --> <tabBarItem key="tabBarItem" title="untitled" image=" " id="6"/>
4- Save the file
5- Open your project again in Xcode.
6- Run Product->Clean
7- Run your project
Warning should be gone.
I had a very similiar problem which I eventually found. The line below was causing the problem using the open as source code method mentioned above.
<tabBarItem key="tabBarItem" title="Events"
image="319365D1-7058-46CD-8420-18E0EAFB2F29" id="a5a-IF-j9f"/>
I got this error from an undo action, simply dropping the image back onto the view controller solved the problem.
Atb
In my case it was because one of my button images was wrongly added to the Background Image container instead of the Image container (in the Inspector). I found it by going through the entire storyboard hierarchy and checking each image and button setting.
Please do a search for image= shows various results. Select results from nibs or storyboard open it, if there is some value like image="2342D4DF-1E6B-42B8-847A-F9F622921D02" delete it and enjoy.
i also faced same problem because i edited image in photoshop and saved as a psd format make sure you save your edited images in jpg or png format in my case that was the problem hope it helps!!!
I got this problem for all of my images after switching one of the label's text to 'attributed' and using one of the 'Fun' fonts. Even though I switch it back to 'plain' I still get the "Could not load..." error - until I re-load and re-reference all of my images again.
Initially my image name is "bg" When i found issue, i rename image as "background" but when click on image and hit "Show in Finder"changes was not reflected. image was name as "bg-1.jpg".
so i removed from project convert image to png and drag and drop into
project it works for me.
Believe or not, sometimes this happens because some IBOutlet was removed and in the storyboard have the reference to it.
Make sure the 'Target Membership' for the 'Assets.xcassets' has been selected.
Click 'Assets.xcassets'
In the 'File inspector', make sure 'Target Membership' selected.

not able to change image in UIImageView control

This seems to me as a bug because I have changed images with:
someImage.image = [UIImage imageNamed:#"anotherImage.png"];
and I have never had a problem. so let me show you what I have:
I have placed an UIImageView:
note that imgObjetivos is conected to this UIImageView.
I have a method that get's called when clicking the following button:
and the method contains:
as you can see I just want to change the current image with:
so when I run the application in the simulator everything looks great:
and when I press the button the image changes successfully:
Now why is it that when I run the application on my iPad the image does not change!? when I press the button the image disappears instead of getting a new image like in the simulator. I just learned objective-c and I am starting to dislike it. What am I doing wrong?
EDIT
I found a solution I changed the name of the image and now it works:
but this makes no sense. Which names works and which ones do not? I also have make sure that I don't have two images with the same name and that is not the case. when I have a few letters after the '_' underscore it does not work. This is really strange. I am starting to dislike objective-c :(
I've had the same problem before. The problem is that the image that you're using to replace the previous image is corrupted or say is not in it's original format.
In my case, I downloaded images in the web which was .jpg format and renamed it as .png format which actually made it .png. so in short term, ipad does not support the functionality for converting image format by just renaming the extension. you have to have a proper converter or something.
I would go with removing the image file from the project, clean the project and add the file back.
I had to rename the image name to something else I don't understand why... I thought that the problem was because I previously deleted that image that contained the same name but that is not the case because I imported the image with a similar name to the solution and I had the same problem. for example the original name of the image was objetivosFoto_h.png and when I renamed to objetivosFoto_ho.png it still did not work but when I renamed to objetivosFoto_horizontal.png it worked.