Objective c 页面控制按钮
我正在做一个项目,我需要做一个有3个图像的页面控件。这很好,但页面控件的图像显示,三个小圆圈仅出现在第一个图像上。我做错了什么Objective c 页面控制按钮,objective-c,ios,cocoa-touch,uiscrollview,uipagecontrol,Objective C,Ios,Cocoa Touch,Uiscrollview,Uipagecontrol,我正在做一个项目,我需要做一个有3个图像的页面控件。这很好,但页面控件的图像显示,三个小圆圈仅出现在第一个图像上。我做错了什么 [scrollView setScrollEnabled:YES]; CGRect frame; frame.size = self.scrollView.frame.size; //INICIO SCROLLVIEW DE FOTOS //Fotos --------- NSArray *imagens = [NSArray arrayWithObjects:
[scrollView setScrollEnabled:YES];
CGRect frame;
frame.size = self.scrollView.frame.size;
//INICIO SCROLLVIEW DE FOTOS
//Fotos ---------
NSArray *imagens = [NSArray arrayWithObjects:@"foto1.png",@"foto1.png",@"foto1.png", nil];
//Fotos ---------
for (int i = 0; i < imagens.count; i++) {
CGRect frame;
frame.origin.x = self.listaFotos.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.listaFotos.frame.size;
//Imagem
frame.origin.y = 0;
frame.size = CGSizeMake(491, 330);
UIImage *image = [UIImage imageNamed:[imagens objectAtIndex:i]];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = frame;
[self.listaFotos addSubview:imageView];
frame.origin.x = self.listaFotos.frame.size.width * i;
}
self.listaFotos.contentSize = CGSizeMake(self.listaFotos.frame.size.width * imagens.count, self.listaFotos.frame.size.height);
self.pageControl.currentPage = 0;
self.pageControl.numberOfPages = imagens.count;
[scrollView设置可滚动:是];
CGRect帧;
frame.size=self.scrollView.frame.size;
//INICIO SCROLLVIEW DE FOTOS
//福托斯---------
NSArray*imagens=[NSArray arrayWithObjects:@“foto1.png”@“foto1.png”@“foto1.png”@“foto1.png”,nil];
//福托斯---------
对于(int i=0;i
您可能正在将页面控件添加到滚动视图中。您应该将其添加到滚动视图的superview中,即作为其同级添加到滚动视图的顶部。这样它就不会在滚动视图中滚动