0

我有PageControl一个观点,我实施了它,它的工作很好,但没有显示,view没有PageControlview我可以在页面之间滑动,但它不会出现在用户面前。

可能是什么原因?

//  scrollView.frame.size.height
    scrollView.pagingEnabled = YES;
    scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * [self.viewControllers count],280 );  scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.showsVerticalScrollIndicator = NO;
    scrollView.scrollsToTop = NO;
    scrollView.delegate = self;
    pageControl.numberOfPages = [self.viewControllers count];
    pageControl.currentPage = 0;

[self loadScrollViewWithPage:0];
4

1 回答 1

0

您应该在滚动视图滚动后执行以下操作来更新 pageControl:

- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    pageControl.currentPage = scrollview.contentOffset.x / scrollview.frame.size.width;
}

更新:头文件应该是:

@property (nonatomic, weak) IBOutlet UIPageControl *pageControl; 
于 2013-01-07T09:25:38.597 回答