I have a problem referencing the assets (image) folder path for my widget on an ImageView.
I have the header widget and I want to add the home button image. the home.png is stored into /widgets/widget.folder/assets/home.png
The documentation says that I should use the WPATH('home.png') macro. I Ti.API.info(WPATH('home.png')) it and it excludes the assets folder, saying /widget.folder/home.png and the $.lbutton.image = WPATH('home.png'); command doesn't show the image I want. why?
I solved changing the ImageView into a Label and assinging Label.backgroundImage to '/image.png' stored into the assets folder of the project. but don't know why ImageView.image doesn't display the image with the same path.
Related
I created the folder and uploaded 3 jpg images. And putting the right path in Image Folder. But it still not show the images on page.
What am I doing wrong?
This looks correct to me.
I suggest trying an alternative path for the Image Folder such as:
/images/Manifestation_Miracle
I also suggest renaming the folder to remove the underscore to see if that helps.
In a UWP app using cppwinrt I want to use WebView to display contents of a book kept in the Assets folder. I read that it is necessary to reference an html asset this way for use as a Uri argument to the Navigate method in web view:
TheWebView.Navigate(Uri(L"ms-appx-web:///SampleBook/PageOne.html"));
This produces an empty view, while
TheWebView.Navigate(Uri(L"ms-appx:///SampleBook/PageOne.html"));
crashes. Msdn says that for files "that will be loaded into the web compartment" one must use ms-appx-web, and I've seen mention that this is a security issue. But does that mean the files are in a special location within the project - i.e. not merely in the Assets folder - or does it only mean that the path must begin with ms-appx-web independent of the file's location? "Web compartment" is not explained but seems to be not a location but rather a classification of the type of resource. At any rate, neither of the above approaches works, so I'm curious to know the recommended way to store and access a collection of html files in the package. In the assets folder? A special folder within assets? In Solution Explorer the html file is listed, "content" is True, and the file is Included In Project. Thanks.
My mistake: ms-appx-web does not point to the assets folder, but to its parent. The correct path for content of this type would be ms-appx-web///Assets/SampleBook/PageOne.html. The reference to material to be "loaded to the web compartment" apparently is just a way of saying: stuff to be loaded with WebViewer.
Not sure how else to specify the path to the image.
I've added a png into a new image named "StatusBarIcon", which lives inside "Images.xcassets" resource folder.
I see they put a json file and what not.
Tried to do what the examples out there say, but no matter what I try, I always get nil as the output of [NSImage imageNamed:#"name of paths attempted here"]
Won't load using the full path either, I suppose the method is looking for the name of the image, but I've no idea how to specify the name correctly it seems, or perhaps I need another method?
Here are screenshots of my code, and my project.
Make sure you have the project set to use xcassets instead of just individual resource files. Once you create an image in the xcasset, you should just specify the name of the image, not the path. For example, [NSImage imageNamed:#"StatusBarIcon"]
To load from the assets catalog of the current bundle, use something like:
let image = Bundle(for: type(of: self)).image(forResource: NSImage.Name(“logo"))!
I'm trying to load an image using NSImage imageNamed: method but i have no success
i have copied the image in the project folder: Project>Resources and added to the project using: "Add files to project ..."
NSImage* image = [NSImage imageNamed:#"logosH"];
if (image == nil){
NSLog(#"NULL :/");
}
NSImageView *accessory = [[NSImageView alloc] initWithFrame:NSMakeRect(0,0,200,55)];
[accessory setImageScaling:NSScaleToFit];
[accessory setImage:[NSImage imageNamed:#"logosH.png"]];
[myAlert setAccessoryView:accessory];
[myAlert setIcon:[NSImage imageNamed:#"HipArthroplastyTemplating.tiff"]];
[myAlert runModal];
here is the code. i have tried every explanation and solution that i can found in other questions but doesn't work, i'm getting the NULL message in console and the setIcon loads anything
i guess that is something with the bundle or something like that (i'm learning Objective-C so this is new)
I have used the code of an example of cocoa developer but doesn't work, i have tried to load my image in that project and it works there!!! but no in my project :/
any help, any idea? thanks a lot
Your image is null because it is not found. This may occur if your image is not copied in your bundle or if the filename is wrong.
Important note: Clean your project before every test to ensure that the resources are updated.
The name of the image should contain the extension too, except for .png where it is not mandatory. If you still have the problem, then it's most likely that the file is not in your bundle. To know if the image is copied to your bundle, click on the image in the Project Navigator (⌘ + 1) and verify in your File Inspector (⌘ + ⌥ + 1) in the Target Membership section that the checkbox right next to your project name is checked.
If the problem is not solved, go in the Project Navigator on your project file (the first file at the top). Be sure that the selection on the left is the name of your project under Target. Then go to the Build Phases tab and open the section Copy Bundle Resources. If your image is not in the list, you have to add it with the + button at the bottom.
Assuming that my JS file is in /libs/qrcode/qrcode.js and i have another file qrcode.html at /libs/qrcode/, is it possible to get current directory/path (i.e. /libs/qrcode/) inside the qrcode.js?
what i'm trying to do is to load qrcode.html in the webview inside qrcode.js without worrying where is the qrcode folder reside in the Resource directory.
Any help?
Try Ti.Filesystem.resourcesDirectory or Ti.includeAbsolute
This should give you the path from your Resources folder or take a look at the Titanium.Filesystem.File