-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];
}
用途:http://stackoverflow.com/questions/5963343/scrollview-with-pagecontrol-programmatically/5963534#5963534 – Deepesh 2012-01-18 05:51:41
简单,我想到一个sk为什么pageNumber总是显示值1 – 2012-01-18 06:36:28