0
images = [[NSArray alloc] initWithObjects:@"w8.JPG",@"w7.JPG",@"w6.JPG",@"w5.JPG",@"w4.JPG",@"w3.JPG", @"w2.JPG", @"w1.JPG" ,@"w9.JPG", nil];
self.pageControl.hidden = NO;
[self.pageControl setNumberOfPages:9];
UISwipeGestureRecognizerDirection direction = [(UISwipeGestureRecognizer *) sender direction];
switch (direction) {
case UISwipeGestureRecognizerDirectionRight:
if (pageController != 0 && imageIndex != 9) {
[self.pageControl setCurrentPage:(pageController - 1)];
pageController --;
imageIndex++;
}
break;
case UISwipeGestureRecognizerDirectionLeft:
if (pageController <= 8 && pageController >= 0) {
[self.pageControl setCurrentPage:pageController];
pageController = pageController + 1;
imageIndex--;
}
break;
default:
break;
}
imageIndex = (imageIndex < 0) ? ([images count] - 1): imageIndex % [images count];
self.imageView.image = [UIImage imageNamed:[images objectAtIndex:imageIndex]];
當我開始在例如向左特定方向輕掃,page control's
點改好,但如果我改變了方向,先刷卡點不會改變,我必須向相反方向滑動兩次以便點改變。當你改變跟蹤方向時,我發現頁面控件再次計算當前點。頁面控制開始重新計數當前頁面,當你改變方向
如何更改此默認設置?
發佈您正在嘗試的代碼片段,以便理解問題。 – 2014-11-01 12:00:48