Phonegap, phonegap build and tabbar - ios

I have been working on a project in phonegap that requires an iOS tab bar at the bottom. I haven't been able to find a working plugin so with the little knowledge I have in objective C, I took this one and modified it so it works with what we need:
https://github.com/tblomseth/cordova-ios-tab-bar
(note that I didn't change anything with the tab bar function)
I am trying to add custom images to my tab bar, and I understand that I can apply said image with the 3rd parameter defined in the www/tab-bar.js file.
TabBar.prototype.createTabBarItem = function ( name, label, image, options ) {}
My problem is i don't know enough about how phonegap build compiles the application to know how to reference the image for the ios code to take over.
The code that takes the image and applies it to the tab is the following:
item = [[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:imageName] tag:tag];
as defined in src/ios/CDVTabBar.m of that repo, but my question is how do I reference the file name for the image? I've tried the following:
Full path
single file name
single file name with reference in config.xml file
None of the above methods have worked.

I was able to figure this out!
I first thought that the image was moved into some kind of bundle that I needed to know the path to, however its not, it's placed in a file similar to a plist lookup.
My file ended up being called www/img/icons/tabs/history.png when i was using:
/www/img/icons/tabs/history.png
history.png
/img/icons/tabs/history.png
The way I was able to find what to call the file is as follows:
Download the APK file from PhoneBapBuild on my Mac
change the .apk extension to .zip
unzip the file
browse the package contents of the payload
look at the file called CodeResources inside the _CodeSignature directory and found the filename.
As soon as I put the string that matched the string in this file, the image showed up just as it should!

Related

Load multiple images from web directory in Objective C

I require a simple but potentially complex solution that I can't seem to find code that translates from Android for my iOS version APP.
I simply need a imageview grid such as shown here from a single web directory: https://www.youtube.com/watch?v=fIX4SnBLaZg
I have a working version on Android but can't seem to figure it out on Objective C.
My working version uses JSON to find each file in the directory and associated text, then simply adds each entry to the grid. The iOS version doesn't need to be as complicated if anyone has any examples?
Would anyone have any examples/snippets/APIs of implementing something like this into iOS?
Or even a simplified version such as only images from a directory. Simply have the thread read an entire folder from URL, file by file, and populate it in imageview's. Then once a user clicks on an image, simply view it full screen?
For your requirement you can use collection view . Please follow the below tutorial
uicollectionview-basic-tutorial
And to get images of jpg stored in bundle under folder named Images
NSArray *imagesOfjpgType = [[NSBundle mainBundle]pathsForResourcesOfType:#"jpg"
inDirectory:#"Images"];
To customize the cell to your design Please use the below code
https://stackoverflow.com/a/16579595/1142743
Also Please find sample from above tutorial which has a label below the image
https://www.dropbox.com/s/1uymyrwtx2yn9fs/RecipePhoto.zip?dl=0

Appcelerator : ImageView and local files

for two days now, i have been looking for the correct place to put my local images and the correct way to access them in the Appcelerator platform (working with Alloy framework).
All i want to do is simply display a local image through an image view component. It works well with an image get from URL but seems impossible to get it from a local file.
this is an simple image view declaration in my index.js controller
/app/controllers/index.js. Where do i have to put my image to get this code working?
var img = Ti.UI.createImageView({
image:'images/DefaultIcon.png',
top:10,
width:100,
height:100
});
$.index.add(img);
I have read all the documentation about that issue and read a lot of similar questions over the internet. Anyway, none of the answers i've been reading bring me the correct solution.
No matter where i put my images into my project directory (assets folder, root folder, resource folder, image folder), those images seem to be not accessible !
I'm currently developing on iOS platform...
I really hope some of you guys have the solution ...!
Best regards,
Quentin
You need to put the images in the /app/assets/iphone/images folder.
Within that folder you can create as many folders as you'd like, the only thing you need to do is update the path accordingly.
So, you have an image with the name myIcon.png. Put this in /app/assets/iphone/images/myIcon.png (and don't forget to include #2x and #3x images in the same folder).
Then, in your imageView use this path /images/myIcon.png.
Want to put it in a folder? For example /app/assets/iphone/images/icons/myIcon.png then reference it in an imageview with /images/icons/myIcon.png.
For android you too need to use the images folder inside app/assets/android. But to specify dimension specific images you can put them in ldpi, mdpi,hdpi,xhdpi,xxhdpi and xxxhdpi folders as specified by Android

Modifying the orbeon-resources-private.jar files causes white screen

I am trying to create my own custom components in orbeon.
I have been following the steps from the documentation and it said to unzip the jar file 'orbeon-resources-private' I did that and done what I needed to do inside the folder. I then zip it back up into a jar file and copy back over to orbeon.
When I start orbeon back up all i get is a white screen. I check the console and see I am getting a GET 404 not found. What the hell.
Next I put the original jar back and it worked again. So now I unzipped the jar and just zipped it back up again. (Surely that will work). Nothing, still a white screen.
Why cant I put another jar bar the original to get it working.
(I have tried creating jar from command line, zipping it and changing file extension, just adding .jar to a folder, all dont work.)
Could really use some insight to this...
Thanks
Which documenation page are you referring to?
I don't know why you would want to modify the orbeon-resources-private.jar.
You can put your own components into WEB-INF/resources or you can configure another path as documented in Overriding or adding resources without changing Orbeon Forms.

icons in a firefox android bootstrapped extension

I'm working on a bootstrapped extension for firefox android, and I have a problem with displaying icons in a new menu item:
itemMenuId = window.NativeWindow.menu.add("Show more details",ico , function() { showToast(window); });
in ico I wrote the uri of the icon file existing in the root of my extension (icon.png is next to bootstrap.js), using data: and file://, like described here but the icon isn't displayed. I don't know how to fix the path for that. Beside I'm having the same problem with the iconURL in the install.rdf file, when I use chrome:// I get nothing, and when I use resource:// I get a missing image. Should I have chrome.manifest to use chrome://? and even if I don't specify the url,to let the image be displayed by default like here it still doesn't work.
<em:iconURL>resource://trackdetect/icon.png</em:iconURL>
I googled it ,but, I couldn't fix it. Please help and thanks.
For the issue, just make sure you have a file named icon.png in the root of the XPI (the same folder as bootstrap.js) and the image will be used. You don't even need the entry in the manifest. See: https://developer.mozilla.org/en-US/docs/Install_Manifests#iconURL
Erik Vold's guide explains how to reference files packaged within a bootstrapped extension.
However it is strange that the icon doesn't appear at the addons list (you don't specify a iconURL, just place icon.png next to bootstrap.js, as you did). Perhaps you should check if the tool you use creates PNGs that conform to the standard.

XNA XACT Where do I place the .xap file?

I've been trying and looking on the internet for ages now, but where exactly do you place the .xap file? I've read that you should place the file in your content folder, but I have a content folder located in;
TheGame\TheGameContent\
But I also have;
TheGame\TheGame\bin\x86\Debug\Content
Which is it? If I add the .xap file to the latter it recognises it when I refresh the solution explorer, but the former does not.
However, if I add the .xap to the latter it gives an error saying it can't find it when I use the following line of code to access it;
ae = new AudioEngine(#"Content\game_content\audio\xact\Win\xna xact file.xgs");
This line apparently gets the \x86\debug path.
Any advice?
Thanks
Visual Studio, go to the Solution Explorer and right click the Content solution (i.e. "TheGameContent (Content)") or a folder in that section and select Add > Existing Item... and select the .xap file. If it isn't in there, it will copy the file into TheGame/Content, but it will also make it ready to load and work within your project.
Basically it's the same as adding an image file to an XNA project, and it will save you all that trouble you are having.

Resources