以下是代码,当超过5页的点数仅在点击第4页及以上后响应时,反转时第2和第3点可选择
if(self.eventDetailPages != Nil)
[self.eventDetailPages removeFromSuperview];
self.eventDetailPages = [[UIPageControl alloc] init];
self.eventDetailPages.numberOfPages = self.evtListData.iTotalPages;
NSLog(@"The total number of pages - %d", self.evtListData.iTotalPages);
CGSize pageControlSize = [self.eventDetailPages sizeForNumberOfPages:self.eventDetailPages.numberOfPages];
NSLog(@"The total width of pages - %f", pageControlSize.width);
self.eventDetailPages.frame = CGRectMake(0, 150, pageControlSize.width,30);
self.eventDetailPages.backgroundColor = [UIColor blackColor];
self.eventDetailPages.center = CGPointMake(self.view.frame.size.width/2, 150);
self.eventDetailPages.clearsContextBeforeDrawing = TRUE;
[self.eventDetailPages addTarget:self action:@selector(pageChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.eventDetailPages];
答案 0 :(得分:0)
在我的情况下,有4个点,点在第三个点及以上点击时或之后响应,而反向第二个和第三个点是可选择的 [m_pPageControl addTarget:self action:@selector(gotonextPage :) forControlEvents:UIControlEventTouchUpInside];
-(void)gotonextPage:(UIPageControl *) pageControl
{
int page = m_pPageControl.currentPage;
NSLog(@"PAGEVALUE%d",page);
[m_pScrollView setContentOffset:CGPointMake(page * m_pScrollView.frame.size.width, 0)animated:YES];
}
我该怎么办?如果我点击第二个点,则当前页面的值不会改变。如果我点击第3个,那么当前页面的值正在改变......