MonoTouch UIBarButtonItem Icon images in project subfolder - ios

Can anyone explain to me why images for UIBarButtonItem only show when I place them into the project root but not when I put them under <projectdir>/images? Build action is "Content" in both cases.
Having my project root cluttered up with image files is not exactly my style.
UPDATE: Looks like the issue is that XCode for some reason recognizes the images in the subfolder but when you actually assign them using the dropdownlist to a control, it emits just the filename of the image without the folder into the xib file. So I don't know who is to blame here but I'd say at the moment is not possible to reliably work with images in subfolders in MonoDevelop/MonoTouch.

We actually store all of our images as embedded resources within the application.
In fact, because we have a common library that is used for MonoDroid, MonoTouch, and Windows Phone, the images are all stored in a common library DLL as embedded resources and we can organize the images in any directory/subdirectory configuration that we wish, including images.
This might be something to look at for your scenario.

Related

Organize code in xcode where same code used for multiple apps

Suppose I have a complete "app framework" I use for different customers. What is different for each is a config file (e.g. where to download new data files), data files and style files (e.g. background image and launch images)
I could of course
Copy code files around to different app folders replacing old ones.
Copy data/config/style files in/out of a single directory.
Use targets (just read up on these, new to xcode) - but does that work well with different asset folders, launch images etc?
Is there a better way? Somehow make a skeleton app / library that each specific customer app then inherits from? How about storyboards etc?
Only thing each customer specific file would change would be all the plist info, ID, launch images, data files etc. The code would be completely unchanged (I expect the skeleton app can handle whatever small nuances each customer will need, but far most is handled by config files. However, should the need arise, it would of course be nice if I could have cusomer specific code and visuals in each customer app, but this is not a requirement from my POV)
From what you're describing using targets is your best bet. So for example you'll have 5 targets in one worksapce, each target is a different app, all are using the same global.framework, each target got her own config.h \ config.m files

Bundle a LOT of images/icons

What would be the best way to include a lot of images in the bundle? I have an index of (game) items thus about 4000-5000 image files (total 27mb so not that big). Just include the whole map in the bundle or maybe first write a script that converts them to NSData? I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one. Would love to hear your thoughts.
27mb isn't a huge amount to download so the easiest option would be to put them in an asset catalog, as Ryan Heitner mentioned in his comment this will allow App Thinning to take place in iOS 9.
I'm not sure what you mean by this:
I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one
Each image will need to have a unique name (this is true regardless of the number of assets you have) and your code references the images by that name so it won't have to "look through all images individually to find a single one".
Alternatively if you really want to reduce the initial download size you could use On Demand Resources (another upcoming iOS 9 feature) to store them on Apple servers and loaded on demand in your code. Presumably you won't be targeting only iOS 9 though so in this case you would need to host the resources yourself and load them using standard techniques (see here, here, here, or use a library.
You should pack them in a texture atlas.
Then, the texture atlas files should be imported in your bundled via a folder reference (blue folder icon) and not a group (yellow folder icon).
Images imported in bundle in folder reference won't be optimized be Xcode on packaging. So you can make your own file optimization using imageOptim. It can compress a lot more than what Xcode can do on JPEG and PNG images.

CCFileUtils naming convention not working so images can't be found

I'm pretty new to xcode and apps so got some source code and am learning by 'playing'. I've been changing some file names and now my images won't load.
I have:
[CCFileUtils setiPadSuffix:#"-ipad"];
[CCFileUtils setRetinaDisplaySuffix:#"-hd"];
which works for all the other images in the source code but the ones I have changed are not being searched for with '-ipad' appended to the file name. When I create the files and add them without the suffix i.e. image.png rather than image-ipad.png they are loaded normally. I want to have the suffix naming convention though.
I have checked the files are named correctly (no rogue capital letters etc)
I have loaded them into the project (copy items into destination group folder, and create groups for any added folders)
I have checked that the files are there in copy bundle resources in the targets build phases.
I've also cleaned/build/relaunched etc many times including deleting the app from the sim and also full computer restart!! Any ideas?
OK folks I've managed to solve this one after two days of painful brain wracking! Whereas most of the images are used interchangeably across the app, some are used for specific levels. The files are named the same i.e background.png but level1/background.png might be different to level2/background.png
There are sections of code that specify specific folders by using a custom getFullPath method written in.
Due to this, instead of images being loaded into the project in groups they needed to be loaded in with the folders being references (Blue folders not yellow).
I finally figured it out by looking into the Library/Application Support/iPhone Simulator files that were being generated.
Also its worth noting that I had to have both sd folders with no file appendices available as well as the -hd.png, -ipad.png and -ipad-hd.png files that were being used as well. So even though I was running on the ipad sim I had to have the iphone sd files available too.
Hope this helps someone in the future!

iPhone App Building Setup - same code different assets

I have a number of apps (about 16 at the moment and growing) which have pretty much identical code. That is the code that drives them is the same.
There are a few things that change between apps, they are:
A PDF file (inside the bundle)
The icon
The name
4 Storyboard screens
As you can imagine it would be a nightmare to maintain 16 independent projects, my main concerns is that Features/Bug fixes in the main code will have to be applied 16+ times. The other thing is actually building and pushing 16 different binaries to the app store.
At the present time (Jan 2014) I want to know if there is a way to do this easily so that I only have to make a code change in one place and the 16+ other projects are updated and pushed to the store.
I have thought about git, or just having 16 projects and writing a bash script to do it for me but that seems dodgy. What is the most elegant solution to this problem that will reduce my overhead?
p.s. I don't want one app with 16 different icons/pdf due to size reasons
p.s.s. Please don't make as a duplicated, I want to know what solutions are there today, not a link to a slashdot question from 2010 :P
You could create a project for each app (so you won't have to change the project settings, e.g. name, icons, bundle identifier, ...) where you add the different PDF files and setup the storyboard screens.
Then you would create the classes in one project and drag & drop the files to the other project but uncheck the Copy items into destination group's folder option. That way you can change the code in any of the projects and it will be updated in all of them. You still have to build and submit each project on its own.
You can create one Xcode project file, with multiple targets. Each target in the project can have its own plist, icon, PDF and etc. Everything else will be shared and in one place.

Finding image resource in iOS app (XCode 4.2)

This feels like a silly question but I'm stumped. I working on an iOS app using XCode 4.2 and I can't find an image file anywhere in the project. The image filename is passed to UIImage imageNamed: so it has to be somewhere local (not downloading it from remote server). What's the best way to find the image?
In my own iOS projects it's trivially easy to locate images: look in the Resources group in the project directory. I've inherited this application and looking in Resources turns up nothing.
The bottom of the navigation panel has an input field which filters what's displayed
Try the Supporting Files folder

Resources