Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

1458279

Suspended
Original poster
May 1, 2010
1,601
1,521
California
I'm looking for info about how to build components that can be used inside of xcode.

Example: VU meter, a needle that bounces around to show a value.

Rather than hard code everything, I'd rather make a reusable component that would show up in IB and you could drag it to your xib screen, just like the stock label, button, etc...

We were able to do this way back in VB5 (we used to call them ocx), so I'm sure there is some way to do this, but I can't find any books, blogs, posts.. nothing...

Can someone point me to a book/blog... that can help me with this.
 
Under XCode 3, the equivalent was IBPlugins (Interface Builder Plugins). But there's limited support for them in XCode 4.
 
Xcode doesn't support plugins for UIKit classes. However, if you create a UIView subclass you can add an instance of it to your nib. Just place a UIView object in the nib and change its class to that of your class. You'll be able to set UIView properties but not any others if you do this. If it were a UIControl subclass or a UIButton subclass you could add one of those to the nib and then set the custom class. It will work correctly when the nib is loaded but it won't have its custom appearance in IB.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.