0
下一個按鈕僅適用於2張圖像我有10張圖片後兩張圖片不能前進前一個按鈕適用於所有圖像,但下一個按鈕只適用於一個和第二個圖像 下面是下一個按鈕代碼UIScrollView下一個上一個按鈕
- (IBAction) nextButtonAction {
if (self.scrollView.contentOffset.x <= self.scrollView.frame.size.width) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x +self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
pageControlBeingUsed = YES;
}
}
// Here is the previous button code
-(IBAction)previousButtonAction
{
if (self.scrollView.contentOffset.x >= self.scrollView.frame.size.width) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x -self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
pageControlBeingUsed = YES;
}
}
將圖像添加到數據庫
-(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];
}
感謝它爲我工作一件事我要問,如果我保存在數據庫中這一形象也僅保存其在索引一個圖像只有我可以發表上述 – 2012-01-16 11:11:48
的代碼你看到我編輯的代碼爲保存圖像 – 2012-01-17 08:58:14
其真正的作品很好....謝謝 – svmrajesh 2014-05-17 06:04:40