How to create an Interface Builder plugin in XCode5+? - iphone

I need make an Object Library, an Interface Builder plugin like Mapkit so that user can drag my Custom Object and add to UIView.
As property, i want to show and configure it with my basic properties.
Any idea how to do this?
thanks.

In Xcode 4.0, Apple has removed support for using custom Interface Builder palettes provided by IBPlugins in the Interface Builder editor. Xibs/Nibs that use such plugins will still compile but they cannot be edited. You'll need to install Xcode 3 (in a separate folder so as not to overwrite 4) and use it to edit xibs with custom palettes.
This is all in Xcode 4's release notes. Stay tuned to prerelease release notes for more updates on this matter.
Update for Xcode 6
Plugins are no longer necessary. See #IBDesignable and #IBInspectable. :-)

You need to create an Interface Builder plugin for that; the static library has nothing Interface Builder knows how to work with.

Related

Custom control within framework not configurable or visible in Xcode

I have created a small selection of custom controls that are tagged #IBDesignable to enable visual configuration within IB. They work perfectly in their parent project/workspace and, as I wanted them to be reusable, I've created a framework.
After importing the framework into another project, I can access the classes programmatically but there is no visual representation in IB and none of the #IBInspectable properties are displayed in the attributes inspector. There are no errors reported during build or run phases. I guess I'm missing something somewhere but does anyone have any pointers?
It would appear that this is not currently possible (using Carthage as a dependency manager at any rate) without considerable effort with workarounds. This kind of defeats the object IMO!
For now it seems that you need to import the framework project into the product project. Explanation here but, for now, this seems dead in the water.

XCode wont let me use a Static Library View in my xib files

I created a new project of type Static Linked Library.
I have moved the code (previously working in the app) to the library leaving all the xib files in the app.
I have changed the export directory and added the library file from the derived data folder so it gets the compiled version and links to it.
I have added the library to the bundle and have verified it is in the app using iPhone Explorer
I have verified that the xib file recognized the new view type by removing and selecting the custom view type in the custom class field of the identity inspector.
I have changed all of the #import commands to reflect the <> VS "" change and have gotten the app to compile.
however none of the methods of my custom class can be executed. and an NSLog reports that the class is its base counterpart as opposed to the custom derived class.
I am at a loss and have spend a long time converting all the code I have to work in a library. I am hoping someone can help with this.
On this issue, it turns out that Objective C's compiler does not load the categories and custom classes in the libraries by default. There are 2 ways to overcome this.
And here are your options.
Create an Activation type method on the category that will be called to "Activate" that Class or Category. This will need to be done before the application loads any nib files. And seems like a bit of a pain in the butt. This was however how I originally overcame this issue.
Add linker flags that will tell objective C to load all libraries and attach any and all Categories and Classes within the libraries before executing the application. (this will need to be done, on top of #import(ing) the correct files from their correct locations. I will provide a graphic below. and provide the flags for search purposes
-ObjC is the first one I added, but -all_load really did the trick.
I hope that others can benefit from this experience.

How to define Outlets and Actions in the Classes Pane in Interface Builder in Xcode 4?

In Xcode 3 one used to be able to define Outlets, Actions etc in Interface Builder by going to the Library > Classes Pane and selecting the class from the list. Is this functionality missing in Xcode 4 ?
There is a File Template Library in the Utility area (Lower Right Corner) in Xcode 4 but my custom clases do not show here !!
This does appear to be removed from Xcode 4, but there isn't much need for it anymore since Xcode 4 integrates the editor directly with IB. The feature never really worked that well in Xcode 3 IMO anyway.
In Xcode 4, display the header for your object by selecting your object and View>Editors>Assistant. Now control-drag from the object you want to connect into the header. This will let you automatically create an outlet or action and bind it all at once.
See the Xcode 4 Transition Guide for more information.
agreed with Rob on that, alternative is to right click your Object in xcode's IB and this will give allow you to select actions/reference etc by means of dragging and dropping

Is there a way to add Interface Builder options to a custom class?

In my app, I made a subclass of UIView that I want to use in Interface Builder. Is there a way to make the instance variables settable via the "Attributes" section of IB?
Yes but not easily. In order for any custom controls to have Interface Builder support, you'll need to develop an IB plugin. I recommend going to the source for the nitty gritty. Take a look at the Interface Builder Plugin Programming Guide. Or, for a less overwhelming source, this blog.

Interface Builder

What is the difference between creating an IPhone application using Interface Builder and without it?
Interface builder is simply an application that can help you place GUI elements and then associate IBOutlets and other in-code functions. you can go into Dashcode and actually read the code generated by Interface Builder but I think you will find that it is LONG and repetitive. Interface builder simply makes it easier to get the interface elements where and how you want them using a GUI. you don't NEED it but its sure useful.
you can create a full interface without an .xib or interfacebuilder you just have to write more code.