Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single View controller with multiple nibs?

I am trying to construct a view controller that can be 'skinned' -- that is, have multiple appearances or personalities but that uses a single controller. Each view will have the same buttons, etc, but I would like to be able to load each nib file (skin) into the same view controller. I can create multiple nib files, but I don't see how to connect the buttons, and actions. Can I specify the same 'file's owner' for multiple nib files? (HOW?).

Can this be done?

like image 603
Billy Pilgrim Avatar asked Dec 13 '10 15:12

Billy Pilgrim


1 Answers

This is totally possible. Just create new nib files and in Interface Builder set the file owner to the class. You can then hook up your outlets and actions just like before. From your code just specify the correct nib file in the initWithNibName: method.

If the only changes are cosmetic, you might be better off just making those changes in code, but your proposed method will work just fine.

like image 125
theChrisKent Avatar answered Nov 17 '22 05:11

theChrisKent