1
Q
连续滚动图像
A
回答
1
在这个例子中,我以总共5幅影像
- (void)viewDidLoad {
[super viewDidLoad];
// add the last image (image4) into the first position
[self addImageWithName:@"image4.jpg" atPosition:0];
// add all of the images to the scroll view
for (int i = 1; i < 5; i++) {
[self addImageWithName:[NSString stringWithFormat:@"image%i.jpg",i] atPosition:i];
}
// add the first image (image1) into the last position
[self addImageWithName:@"image1.jpg" atPosition:5];
scrollView.contentSize = CGSizeMake(320, 2496);
[scrollView scrollRectToVisible:CGRectMake(0,416,320,416) animated:NO];
}
- (void)addImageWithName:(NSString*)imageString atPosition:(int)position {
// add image to scroll view
UIImage *image = [UIImage imageNamed:imageString];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(0,position*416,320, 416);
[scrollView addSubview:imageView];
[imageView release];
}
实现委托方法
- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender {
NSLog(@"%f",scrollView.contentOffset.y);
// The key is repositioning without animation
if (scrollView.contentOffset.y == 0) {
// user is scrolling to the left from image 1 to image 4
// reposition offset to show image 4 that is on the right in the scroll view
[scrollView scrollRectToVisible:CGRectMake(0,1664,320,416) animated:NO];
}
else if (scrollView.contentOffset.y == 2080) {
// user is scrolling to the right from image 4 to image 1
// reposition offset to show image 1 that is on the left in the scroll view
[scrollView scrollRectToVisible:CGRectMake(0,416,320,416) animated:NO];
}
}
1
我给出两个参考链接,自动滚动,滚动图,其中还可以虎视眈眈的源代码,并落实到你的项目这是惊人的funcationality
1)Automatically scroll the scroll view
2)As par your requirement created post of like wise gallery.
本帖子对您有所帮助。
快乐codeing 感谢和问候,
@Samuel
相关问题
- 1. FullPage.JS连续滚动
- 2. 伪连续滚动
- 3. 连续自动滚动ListView
- 4. 连续滚动图片横幅Jquery
- 5. 在jQuery中连续滚动包含图像的水平滚动条?
- 6. 如何使用jquery垂直连续滚动图像
- 7. 寻找一个jQuery连续图像滚动条
- 8. 继续为图像滚动效果?
- 9. 在wpf中的图像控件中从上到下连续滚动图像c#
- 10. 连续滚动的问题
- 11. 离子连续滚动
- 12. jQuery垂直连续滚动
- 13. 停止连续滚动smoothdivScroll
- 14. UITableView断断续续滚动没有图像或内容提取
- 15. 如何让背景图像连续水平滚动而不中断动画?
- 16. 连续滚动div菜单动画jumpy
- 17. 将图像连续对齐
- 18. 连续旋转图像
- 19. Gulp连续生成图像
- 20. 滚动图像
- 21. 滚动视图与图像不滚动
- 22. 连续的横向滚动会在背景图像显示中产生异常
- 23. 如何在Open GL中创建连续重复的滚动背景图像?
- 24. 如何使用JScrollPane连续滚动
- 25. 连续的HTML页面滚动
- 26. jquery连续水平滚动不工作
- 27. 在jQuery中连续滚动div
- 28. jQuery无限/连续滚动悬停
- 29. jQuery SmoothDivScroll - 不带autoScroll的连续滚动?
- 30. 悬停以连续滚动水平格
我想你问为此, http://stackoverflow.com/questions/3763978/360-panorama-librarys-for-ios。 – Vignesh 2012-02-16 07:06:23