1
我有滾動視圖,其中包含5個視圖,它包括頁面控制,當我點擊頁面控制的第四個泡沫時,它移動到第二個視圖,但我希望它應該直接移動到第四個視圖,請幫我解決這個問題問題。的PageControl的頁面控制直接切換
電話如下:
[pageControl addTarget:self action:@selector(pageTurn:) forControlEvents:UIControlEventValueChanged];
實現pageTurn方法如下:
- (void) pageTurn: (UIPageControl *) aPageControl
{
int whichPage = aPageControl.currentPage;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
scrollView.contentOffset = CGPointMake(320 * whichPage, 0);
[UIView commitAnimations];
}
和我scrollViewDidScroll如下:
- (void) scrollViewDidScroll: (UIScrollView *) aScrollView
{
CGPoint offset = aScrollView.contentOffset;
pageControl.currentPage = offset.x /320 ;
}
thnx的答覆和它的作品 – 2011-12-19 06:20:51