-1
我在UIPageViewController
中使用UIScrollView
进行捏合和缩放功能。有时UIPageViewController
未触摸,页面也不转动。UIPageviewcontroller正在失去姿态
我在UIPageViewController
中使用UIScrollView
进行捏合和缩放功能。有时UIPageViewController
未触摸,页面也不转动。UIPageviewcontroller正在失去姿态
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];
}
写手势
行动