0

我有一个 ScrollView (contentScrollView),它稍后应该包含 20 个页面,每个页面都有一个 UIViewController。

现在这是我将 UIViewControllers 视图添加到 contentScrollView 时得到的(右上角的 Button 来自 MainViewController,因此不会影响问题) 顶部的灰色条?!

我在我的 ContentScrollView所在的MainViewController类中得到了这段代码:

 Slide1ViewController*test = [[Slide1ViewController alloc] init];
test.view.frame = CGRectMake(0, 0, 1024, 768);
[self.contentScrollView addSubview:[test view]]; 

当我在设置框架后立即添加这样的背景时:

test.view.backgroundColor = [UIColor blackColor];

然后我得到黑色背景,顶部没有那个 Bar,但 Slide1ViewController.xib 中的标签不会出现。

希望可以有人帮帮我。

4

2 回答 2

0

对不起,我没有意识到 UINavigationController 仍然被选中,所以我创建了这个类,同时相信它是一个 UIViewController

于 2012-07-27T09:51:06.110 回答
0

如果你真的需要 20 个页面,每个页面都有一个视图控制器,你应该使用 uinavigationcontroller,如果你真的想要一个滚动视图,请使用 uitableview 并使每个单元格成为你的 uiviewcontroller 之一的视图,因为这样每个视图都将被加载需要时,而在滚动视图中,您可能会同时加载太多竞争。

于 2012-07-27T08:11:02.100 回答