I have scroll view with page controll i have images in scroll view i want to save any image i want in sqlite data base problem is that always pageNumber shows only one
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];
}
You should get your answer here.