0

I have a ScrollView (contentScrollView) which should later contain 20 pages with a UIViewController for each page.

Now this is what I get when adding the UIViewControllers view to the contentScrollView (the Button in the upper right corner is from the MainViewController so it doesn't affect the problem) gray bar at the top ?!

and I got this code in my MainViewController class where my contentScrollView is in:

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

when I add a background like this right after setting the frame:

test.view.backgroundColor = [UIColor blackColor];

then I get the black background without that Bar on the top but the Label which is in the Slide1ViewController.xib won't appear.

Hope someone can help me.

ferdyyy
  • 515
  • 4
  • 16

2 Answers2

0

If you really need 20 pages beaing each one a view controller you should use a uinavigationcontroller and if you really wanna have a scroll view, use a uitableview and make each cell the view of one of your uiviewcontroller because that way the each view will be loaded when needed, whereas in a scroll view you might get too much contend loaded at the same time.

Nicolas Manzini
  • 8,379
  • 6
  • 63
  • 81
0

I'm sorry i didn't realize UINavigationController was still selected so that i created the class while believing it's a UIViewController

ferdyyy
  • 515
  • 4
  • 16