UIScroll查看分页

时间:2012-01-18 05:42:47

标签: iphone objective-c

我有滚动视图与页面控制我有滚动视图中的图像我想保存我想要的任何图像在sqlite数据库的问题是,总是页面数字只显示一个

 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];
      }

1 个答案:

答案 0 :(得分:0)

您应该得到答案here.