Building components to use in xcode

Discussion in 'iOS Programming' started by 1458279, Oct 31, 2011.

  1. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #1
    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.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    Under XCode 3, the equivalent was IBPlugins (Interface Builder Plugins). But there's limited support for them in XCode 4.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    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.
     

Share This Page