开发者

Best Practices for refactoring controls and functionality out of a XIB

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 m开发者_开发问答e. I'm open to any clean way of factoring this into it's own component.)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜