0

I have a regular custom UIViewController that loads a regular iPhone-screen-sized XIB. But I have a subview in the XIB that consists of a few components (UILabel, UITextField, UIButton) that I'd like to factor into a separate XIB, and move the logic controlling these components out of the UIViewController, possibly to a custom UIView object that would load the custom XIB.

I've searched Apple documentation without much luck, and searched for an answer here, but I can't seem to find a clean way of creating a custom UIView, instantiating it in a XIB, and dropping it into another XIB. Is there a clean way of moving this view into it's own XIB and the logic controlling it out of the custom UIViewController, so I can use it on multiple screens of my app?

(I'm not married to the idea of putting this functionality into a custom UIView, it just seemed like the obvious way of doing it to me. I'm open to any clean way of factoring this into it's own component.)

César
  • 9,939
  • 6
  • 53
  • 74

1 Answers1

1

If you want to know about multiple views in xib u can go through this

Multiple Views within one XIB - iPhone SDK

This may help you.

If you want to create a view in xib without view controller go through this

Using a xib file without initializing a view controller

I think this should be useful

Community
  • 1
  • 1
visakh7
  • 26,380
  • 8
  • 55
  • 69
  • The first link describes having multiple views in one XIB and isn really applicable. The second link describes programatically loading a XIB, but doesn't mention where to put the code that controls the components in the XIB. I'm hoping to be able to load the UIView in it's own XIB from another XIB in interface builder, then manipulate the controls in that view using methods written specifically for that view. Hope that makes sense :S – smweber Mar 08 '11 at 06:45