Is it possible to create a library/framework with xib files inside it ?
Same as MessageUI framework.
Need some reference examples.
Thanks in Advance.
No, it is not possible to include xibs inside a static library/framework. You should create a bundle target that will contain all the xibs, image assets, etc that the library will need. In your library, you must then reference the resources from this bundle.
Related
I need to use my existing objective C code in an app which I am developing in Swift. Is it allowed to import the existing .xib file from the objective C app and use it in my current Swift app?
A XIB doesn't contain either ObjC or Swift but some proprietary Apple XML that describes the UI you built in Interfacebuilder
XIBs made in 'ObjC Apps' are therefore the same as in 'Swift Apps' and can happily be reused.
no bridging required since you aren't copying code but xibs
(note that classes could also be used without a problem if this isn't about XIBs only.)
Net Developer planning a new Product.
It will amongs other things generate dynamically its User Interface from a downloaded File.
I read that file and depending on it i create the necesseray buttons, labels, tables etc..
I wish to outsource that similar kind of product for a development for the IPhone..
So my question to Iphone experts is. Is this possible with the Iphone too?
With 'possible' I mean basically if it is technically possible and if it is 'allowed' on MacStore..
Any feedback is much appreciated...
The user interface files on the iOS, the (the XIB files), are nothing more than a files containing archived objects. So when you create a static interface in Interface Builder, what Xcode actually does is to create objects for all the UI elements, setting the object properties according to your wishes, setting up the object graph (which objects has references to which other object) and finally archives the whole graph into a file. When you load a XIB file, the objects are simply unarchived and you get an object graph with all the UI objects in their desired states.
That means whatever can be done by loading an interface from a XIB file can also be done problematically. All you have to do is creating the objects yourself, setting all the properties as desired and chaining them to the desired object graph. And yes, creating UI problematically is absolutely allowed by the App Stores (for Mac and for iOS), since it does the same thing by hand as loading a XIB file does automated.
Yes, it is possible and allowed. There are very little UI related operations that can't be done programatically on Cocoa Touch.
Ok, I have an iPhone project that utilizes the camera.
I'm trying to utilize 80% of the same code for an iPad version of this project, however, I have to change some values as the camera quality in the latter device is messing with some parameters which I used as criteria for the first device.
So what I did was: I duplicated the iPhone project and had two targets in total, in the same project, the first one - for the iPhone (the original), and the second for the iPad.
When I clicked on the second target and added a comment on some .m file, the same comment appeared in the same .m file in the iPhone version's file too.
I don't want that - as you can see, I want a separation. I want to use the iPhone project as a base to modify the code of the iPad project. But how do I do this ? If the comment appeared in the iPhone .m too then obviously that means there is no distinction , and that whatever I do in the iPad .m will mess up the other .m ?
it looks like your two projects are sharing the same files. If you want to keep them separate, just duplicate the source files and add them back to the projects individually.
I'd create a universal app. That way you can share all of your code between the two devices in a single project. Then you can simply separate logic for each device type into different files. So for example, have ViewControllerA for both device, and ViewControllerA_iPhone and ViewControllerA_iPad for the each separate device.
Possible duplicate:
Conditional Compilation between ipad and iphone
I think you don't need a second implementation file, you just need to compile for a different device or check which one you are on at runtime and adjust accordingly.
I think don't need to copy the entire project. You can just copy the necessary files only and create logical groups for iPhone and iPad. Check the device type into appdelegate class if it is iPad then call iPad related class else iPhone. Hope it will help you.
it sounds to me like you need to 'extend' the functionality of the original to incorporate the new.
Would it not be easiest to create the 'interface' and then an base form of the class (maybe make it abstract), that implements all the methods, but leaves those that may have special needs (just have them throw an error as basic method functionality)
Then for the 2 projects you can extend the abstract class and overide the methods adding in the functionality that you require.
The beauty is that if there is an error condition in the overidden methods you can just call the 'superclass' abstract method and throw out the error message, you may decide that the super class method should take a string input variable to enable you to use a customised message taged onto the end of the one in the abstract class.
David
What name convention the new images have to have to be loaded by the new iPhone 5?
We see that we have to have 3 default images to be loaded by the device
Default.png
Default#2x.png and
Default-568h#2x.png
what about the other images used by an app?
Is there a naming convention that will automatically load the correct image?
The new default is Default-568h#2x.png. (note hyphen)
There is no other corresponding change. If you need a different image for the new iPhone 5 screen then you have to create it as a separate name. There is no 1x/2x/new phone auto switching behavior.
If you are looking for something similar to ~iPad or ~iPhone (like ~586h) there isn't anything build in like that. But you can easily add it yourself by expanding UIImage class.
Have a look at this source snippet (UIImage+Retina4) for information about how to achieve. Just add this UIImage category and there will be support for ~568h#2x files.
I solve this problem here. Just add #2x~568h suffix to images or ~568h to xib's. Also you can use this images in xib's.
With the introduction of Asset Catalog in Xcode 5, all you have to do with the images is simple drag and drop to its corrosponding related areas. Everything else will be handled by the Xcode itself..
You can create new catalog by going to the above mentions option in the screenshot.
I have a universal app.
I wrote all the iPhone code. Noe, rather than rewrite the code exactly the same, I would like to just have specialized xib files. How do I set up this new xib files. How to I create them and how do I link them to my iPhone classes. then how do I load them, meaning make the app pick the iphone xib or the ipad xib
thanks in advace
Note, I'm using Xcode 3
when you instantiate you controller using alloc init , Use initWithNibName and use the nib or .xib name you to associate with project.
hmm, you say "I have a universal app", but sounds like you mean "I have an iPhone app and want to create a Universal App". If so, here is some info I used the first time I did this:
http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html
Jeff Lamarches stuff is pretty reliable I think.