이전 버튼을 누르면 아무런 효과가 없습니다. 다음 버튼은 제대로 작동하지만 이전 버튼에는 이전 이미지가 표시되지 않습니다. 나는 이미지를로드 할 scroll view
을 사용하고 있습니다 : 사용자가 세 번째 이미지에 도달 할 때버튼 클릭을 사용하여 ScrollView에서 이전 이미지 이동
- (IBAction)next{
int arraycount = [appDelegate.articles count];
for (int nextIndex = [pageControl currentPage]; nextIndex < arraycount; nextIndex++) {
if (self.scrollView.contentOffset.x <= self.scrollView.frame.size.width) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x + self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
pageControlBeingUsed = YES;
}
}
}
-(IBAction)previousButtonAction
{
int arraycount = [appDelegate.articles count];
NSLog(@" arraycount : %d", arraycount);
NSLog(@" [pageControl currentPage] : %d", [pageControl currentPage]);
for (int nextIndex = [pageControl currentPage]; nextIndex>arraycount; nextIndex--) {
if (self.scrollView.contentOffset.x >= self.scrollView.frame.size.width) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x + self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
pageControlBeingUsed = YES;
}
}
}
에서 발생합니다. 여기에서 언급하지 않은 루프의 인덱스 값 – user1107725
doh! 위의 편집 된 답변. – ader
그 이전에 원한다면 작동하는 완벽한 감사 만이 감소 기호 만 사용할 수 있습니다. – user1107725