How to load UIImage from folder in assets library - objective-c

I am trying to load an image from my XCode assets library:
Using this code:
[self.imgIcon setImage[UIImage imageNamed:#"symptoms/anxious.buz"]];
It works if I don't have the asset in a folder in the assets library. I've also tried renaming it to .png, as well as using 'symptoms.anxious.buz'. Because it works without a folder, I suspect there is some special way to form the path to indicate you want to look inside a folder.
What is the proper grammar for loading an asset from inside a folder of the assets library?

If you want the name of the folder to be part of the image name then you need to tick the Provides Namespace option on the folder in the asset catalog...
Otherwise you can just use the asset name without the folder. So in your case...
[UIImage imageNamed:#"anxious.buz"]

Related

Vue: Cannot find module (image) in the file

I wrote a line which shows a picture like
And my asset folder is structured as
Yet this is throwing
Solutions I've tried:
Tried using
.
Still the same problem.
Any solutions?
Your screenshot shows assets under public, but your import URL uses the # prefix, which is a common alias for <projectRoot>/src.
You can move public/assets to src/assets so that the #/assets URL would be found:
public/assets --move--> src/assets
This solution has the advantage of minimizing the build output, only including files that are actually used in code. The included images also go through Webpack's processing, e.g., if you've configured image optimization.
Alternatively, you can keep public/assets and use a static asset URL, which is the base URL prefixed to the path under public. For the play.img and a base URL of / (the default), the static URL would be /assets/img/play.img:
<img src="/assets/img/play.img">

Vue.js: folder is missing when publish

When I publish the project: npm run build a folder that I created with images is missing from the dist folder.
I created this folder inside the src folder.
assets folder is also missing.
Where is it?
If you just want some folders included verbatim, put them in the public folder.
Any static assets placed in the public folder will simply be copied and not go through webpack. You need to reference them using absolute paths.
Things within src are only included if they're part of the bundle (ie they have been imported / required) and even then, any folder structure won't be preserved. Bundled items are typically renamed with a hash checksum and all put into a single folder like js, css, images, etc.

compass-rails within a rails engine

I am trying to make a rails engine use the sprite generation capabilities of compass.
I added compass-rails to the main app's Gemfile (outside the assets group).
In the engine's CSS file I do:
#import "my-engine/icons/*.png";
#include all-icons-sprites;
Alas, the app looks for images at the wrong dir
ActionView::Template::Error (No files were found in the load path matching "my-engine/icons/*.png". Your current load paths are: /home/dan/work/main-project/app/assets/images
(in /home/dan/work/my-engine/app/assets/stylesheets/my-engine/sources.css.scss)):
How and where should I configure compass to look in the right path?
2 things to check:
The compass plugin looks in the app/assets/images folder for content.
Files need to have a PNG extension only.
Update for comments
If you would like to save the images elsewhere in your application, for example 'public/sprites', you can specify the follow config setting in your config/application.rb:
config.compass.generated_images_dir = 'public/sprites'
Furthermore, since the new sprite file is being saved in 'public/sprites/icons-xxx.png', you will need to add the output path to the assets path in your config/application.rb:
config.assets.paths << Rails.root.join('public', 'sprites')

Specify paths for Icons

OK, so here's my situation :
My app graphics are not copied into the Bundle's resources folder, but into a subfolder (e.g. Resources/Graphics)
I need to properly set the icons - either for the app icon, or the document types associated with the app - in the info.plist
However, here's the issue :
If I set CFBundleIconFile = "myicon"; and myicon.icns is in the Resources bundle folder, it works fine.
If myicon.icns is in the Graphics subfolder, then - even if I set a path like CFBundleIconFile = "Graphics/myicon"; or CFBundleIconFile = "Graphics/myicon.icns"; - it doesn't seem to pick it up.
So, any ideas how this can be fixed? (obviously without telling me to copy the .icns in the Resources folder).
Subfolder doesn't matter in this case, so you dont need to set the full path, only file name, without extension.
CFBundleIconFile = "myicon";
this line will be enough for the app to load the correct file from the bundle.
You aren't allowed to have several icon files with same name in one project/bundle.
You aren't required to copy the files into Resources folder, only thing is that the file must be added to the project.

put icons under Resources subfolder

When I tried to archive one of my iOS projects, I got this warning message:
Validate MyApp.app ...in ....
Icon specified in the Info.plist not found under the top level app wrapper: Images/icon.png
I have put all images files under Resources/Images and created folder reference to Images folder in the project. What value I should give to Info.plist for icons images under a folder reference?
This is my current values:
Make sure that folder reference is setup properly. This can happen when the folder path is not specified correctly in relation to the project folder.
Just noticed, where is the itunesartwork.png file? I see it listed in your plist, but not in the folder.