Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 页面控制按钮_Objective C_Ios_Cocoa Touch_Uiscrollview_Uipagecontrol - Fatal编程技术网

Objective c 页面控制按钮

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:

我正在做一个项目,我需要做一个有3个图像的页面控件。这很好,但页面控件的图像显示,三个小圆圈仅出现在第一个图像上。我做错了什么

[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中,即作为其同级添加到滚动视图的顶部。这样它就不会在滚动视图中滚动