将笔尖添加到UIScrollView中 [英] Add nib into UIScrollView
问题描述
我在使用UIScrollView时遇到麻烦.
I am having troubles with the UIScrollView.
我有一个文件:ExhibitionViewController.h/m和一个笔尖ExhibitionView.xib,其中放置了一个UIScrollView.
I have a file called: ExhibitionViewController.h / m and a nib ExhibitionView.xib in which I have placed a UIScrollView.
我有一个名为ExhibitionSubViewController.h/.m和ExhibitionSubView.xib的文件,我想在该UIScrollView中显示它,但似乎无法正常工作.
I have a file called ExhibitionSubViewController.h / .m and ExhibitionSubView.xib which I would like to display within that UIScrollView and I cannot seem to get it to work.
正确的代码是什么?
推荐答案
iPhone编程模型是每个屏幕一个视图控制器",这需要一些习惯.您应该使用[NSBundle loadNibNamed:]加载子视图,然后使用addSubview将其手动添加到UIScrollView中.您用于管理这些对象的所有代码都应位于ExhibitionViewController中.
The iPhone programming model is "one view controller per screen", which takes some getting used to. You should load your subview with [NSBundle loadNibNamed:] and add it manually to your UIScrollView with addSubview. All of your code for managing those objects should live in ExhibitionViewController.
这篇关于将笔尖添加到UIScrollView中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!