-1

UIScrollViewのピンチとズーム機能に使用していUIPageViewControllerます。時々UIPageViewController、タッチがつかず、ページがめくれません。

4

1 に答える 1

0
    I think this may help you  

      //*-- pagecontrol
            pageControl.frame = CGRectMake(0,390,320,30);
            pageControl.numberOfPages = 2;
            pageControl.currentPage = 0;
            [self.view addSubview:pageControl];
            pageControl.backgroundColor = [UIColor darkGrayColor];



          //*-- Gesture 
            self.pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGesture:)];
            self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
            tapGesture.numberOfTapsRequired = 1;
            [imageview addGestureRecognizer:self.pinchGestureRecognizer];
            [imageview addGestureRecognizer:self.tapGesture];

    //delegate
        - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
            CGFloat pageWidth = self.scrollView.frame.size.width;
            float fractionalPage = self.scrollView.contentOffset.x / pageWidth;
            NSInteger page = lround(fractionalPage);
            self.pageControl.currentPage = page;


        }

 (void)changePage:(id)sender
{

    //*--  Change the scroll view

    CGRect frame = scrollView.frame;
    frame.origin.x = frame.size.width * pageControl.currentPage;
    frame.origin.y = 0;
    [scrollView scrollRectToVisible:frame animated:YES];
}

ジェスチャーのアクションを書く

于 2012-12-20T13:51:14.900 に答える