我一直在努力尝试让UIImageView在UIScrollView滚动时更改图像,有点像Photos.app。如何制作UIScrollView图片库? (iPhone SDK)
这里是我的代码:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (scrollView.contentOffset.x > 296){
self.currentDBNum++;
self.currentDoorbell = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[[self.doorbells objectAtIndex:currentDBNum] objectForKey:@"Image"] ofType:@"jpg"]];
self.doorbellPic.image = currentDoorbell;
self.currentSoundPath = [[NSBundle mainBundle] pathForResource:[[doorbells objectAtIndex:currentDBNum] objectForKey:@"Sound"] ofType:@"caf"];
}
}
任何提示?谢谢。 (这些图像有296的宽度)
要了解更多关于TTPhotoViewController退房:https://github.com/facebook/three20 – 2011-02-04 18:16:36