Note that there are some explanatory texts on larger screens.

plurals
  1. POUIScrollVIew only showing first static subview, delegate of UIPageControl
    primarykey
    data
    text
    <p>I am a newbie of IOS development, my problem is I am using UIScrollView and UIPageControl to show guide info to users. I created a xib file related to <strong>GuideViewController</strong> via setting up <strong>File's Owner</strong>. I setup the content size and statically add subviews in xib files. But I encountered some strange thing, scrollview only shows the first subview on screen, all following display is just white background (when I scrolling). Following is the code:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. NSInteger numberOfPages = 2; self.pageControl.numberOfPages = numberOfPages; self.pageControl.currentPage = 0; self.pageScroll.delegate = self; self.pageScroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfPages, self.view.frame.size.height); self.pageControl.currentPageIndicatorTintColor = [UIColor redColor]; } -(void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat pageWidth = self.view.frame.size.width; int page = floor((scrollView.contentOffset.x - pageWidth/2) / pageWidth) + 1; self.pageControl.currentPage = page; } </code></pre> <p>I googled a lot to find the answer but still stuck here. I am also confused by this sentence <strong>"When a user taps a page control to move to the next or previous page, the control sends the UIControlEventValueChanged event for handling by the delegate"</strong> in xcode help. It seems UIPageControl has no delegate attribute,so how I can capture the <strong>UIControlEventValueChanged</strong> event.</p> <p>Actually I am developing my main UI on storyboard, but I kind of want separate UI design to make more space for storyboard, so i use xib file for some other part UI, I do not know whether this will cause some problems. Thanks</p>
    singulars
    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.
 

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