2012-05-21 45 views
0

我正在做一個項目,在那裏我需要用3個圖像做一個PageControl。這是在開玩笑,但是頁面控制的圖像,三個小圓圈只出現在第一張圖像上。我做錯了什麼?頁面控制按鈕

[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; 

回答

2

您可能將頁面控件添加到滾動視圖。您應該將其添加到滾動視圖的超級視圖中,即作爲它的兄弟,並在滾動視圖的頂部。這樣它就不會滾動視圖。