У меня есть режим прокрутки с управлением страницей. У меня есть изображения в режиме прокрутки. Я хочу сохранить любое изображение в базе данных sqlite. Проблема в том, что всегда pageNumber показывает только один
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];
}