具有多个笔尖的Single View控制器? [英] Single View controller with multiple nibs?

查看:55
本文介绍了具有多个笔尖的Single View控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构造一个可以蒙皮"的视图控制器-即具有多种外观或个性,但使用单个控制器.每个视图将具有相同的按钮等,但是我希望能够将每个笔尖文件(皮肤)加载到相同的视图控制器中.我可以创建多个笔尖文件,但看不到如何连接按钮和动作.我可以为多个笔尖文件指定相同的文件所有者"吗? (如何?).

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?).

可以做到吗?

推荐答案

这是完全可能的.只需创建新的nib文件,然后在Interface Builder中将文件所有者设置为该类即可.然后,您可以像以前一样连接渠道和操作.从代码中,只需在initWithNibName:方法中指定正确的nib文件.

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.

这篇关于具有多个笔尖的Single View控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆