views:

4914

answers:

5

I want to build a custom control to reuse in my project which consists of two UITextFields that are linked together + a label.

It is starting to become repetitive across my App and smells of code duplication ;)

However, I wonder what is the best aproach here.

Is it best do everything by code in a controller or is posible do a visual thing like the ones built-in in Xcode?

+4  A: 

You can build an Interface Builder plug-in for this. It's fairly straight-forward. To get started, read the Interface Builder Plug-In Programming Guide. It even has a quick, step-by-step tutorial to get you started. Apple recommends creating a plug-in to IB for just your case...

Jason Coco
The link has changed to this:http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/IBPlugInGuide/Introduction/Introduction.html
ordord00
A: 

This is fine except it is for the iPhone. The iPhone presents a more difficult environment to create the plug-in for interface builder. It should be possible but I have yet to see a xCode project that does this. They are all limited to creation of desktop "AppKit" versions, not iPhone "UIKit" versions of the plugins for IB.

Tjp
+2  A: 

I don't think this is possible. I briefly looked at the IB Plug-In Programming Guide and apparently Interface builder plugins are implemented through Custom Cocoa Frameworks. That is, your plugin is defined in a framework which is loaded in Interface Builder. IB looks in the current projects frameworks to find any custom components defined and will load plugins accordingly. It is not possible to use custom or third party frameworks on the iPhone so I don't see how IB would make a connection here. If somebody has more info I'd love to see this discussion continued.

Cliff
A: 

Any luck on using IB plug-in in iPhone application??????

A: 

I also want to create custom iphone sdk plugin that is similar to UITextarea but it should also allow programmers to insert image.

Ayaz Alavi