2012-01-18 88 views
-1

我已经滚动视图与控制研究我在滚动视图图像我要救我想在sqlite的数据库问题的任何图像页面总是PAGENUMBER只显示一个UIScroll查看寻呼

here i am setting the current page Value 
     - (void)scrollViewDidScroll:(UIScrollView *)sender { 

     CGFloat pageWidth = scrollView.frame.size.width; 
      int page = floor((scrollView.contentOffset.x - pageWidth/2)/pageWidth) + 1; 
     [pageControl setCurrentPage:page]; 


     } 


    -(IBAction)addToCollectionButtonAction{ 




     GeoNewsAppDelegate *appDelegate = (GeoNewsAppDelegate *)[[UIApplication sharedApplication] delegate]; 

    // Create a Coffee Object. 
    Coffee *coffeeObj = [[Coffee alloc] initWithPrimaryKey:0]; 

    int pageNumber = [pageControl currentPage]; 
    NSLog(collectionImage); 


    RowTwo*aRowTwo=[appDelegate.articles objectAtIndex:pageNumber]; 
    NSString*thumb2=aRowTwo.image; 

    coffeeObj.thumb = thumb2; 
    coffeeObj.path = thumb2; 


    [appDelegate addCoffee:coffeeObj]; 
     } 
+0

用途:http://stackoverflow.com/questions/5963343/scrollview-with-pagecontrol-programmatically/5963534#5963534 – Deepesh 2012-01-18 05:51:41

+0

简单,我想到一个sk为什么pageNumber总是显示值1 – 2012-01-18 06:36:28

回答

0

你应该把你的回答这个问题[链接] [1] [1] here.

+0

我编辑了代码并包含当前页面代码检查 – 2012-01-18 07:10:22