Note that there are some explanatory texts on larger screens.

plurals
  1. POUIScrollView / Adding xibs to it
    primarykey
    data
    text
    <p>I am trying to create a scroll view and add 2 xib screens (SVPage1.xib and SVPage2.xib) to it so that I can flip through both screens.</p> <p>I created scrollview and Page Control object.</p> <p>This is what I have in .m file:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"SVPage1" owner:self options:nil]; UIView *mainView = [subviewArray objectAtIndex:0]; [self.scrollView addSubview:mainView]; CGRect frame; frame.origin.x = self.scrollView.frame.size.width * 2; frame.origin.y = 0; frame.size = self.scrollView.frame.size; NSArray *subviewArray2 = [[NSBundle mainBundle] loadNibNamed:@"SVPage2" owner:self options:nil]; UIView *mainView2 = [subviewArray2 objectAtIndex:0]; [self.scrollView addSubview:mainView2]; //Set the content size of our scrollview according to the total width of our imageView objects. scrollView.contentSize = CGSizeMake(mainView.frame.size.width * 3, mainView2.frame.size.height); } #pragma mark - UIScrollView Delegate - (void)scrollViewDidScroll:(UIScrollView *)sender { // Update the page when more than 50% of the previous/next page is visible CGFloat pageWidth = self.scrollView.frame.size.width; int page = floor((self.scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1; self.pageControl.currentPage = page; } </code></pre> <p>I believe when I load the second xib file I load it over the first one.</p> <p>When I run the program I see second xib file on the screen and when I flip through the other pages they are blank. I think I am doing something horribly wrong trying to add the second .xib...</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload