1:假如有6个图片:那个,Scrollview的大小加 7 个图片的大小

2:

  //ImageScrollView;
UIScrollView *imageScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(, , , )];
imageScroll.bounces = YES;
imageScroll.pagingEnabled = YES;
imageScroll.userInteractionEnabled = YES;
imageScroll.showsVerticalScrollIndicator = NO;
imageScroll.showsHorizontalScrollIndicator = NO;
imageScroll.delegate = self;
imageScroll.contentSize = CGSizeMake( * , );
[theScrollView addSubview:imageScroll];
[imageScroll release]; //加上图片;
for (int i = ; i < ; i++) {
UIImageView *aImageView = [[UIImageView alloc]initWithFrame:kCR( + *i, , , )];
aImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"keenLC%d.jpg",i+]];
if (i==) {
aImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"keenLC%d.jpg",]];
} [imageScroll addSubview:aImageView];
[aImageView release]; }
//图片数字label
imageNumLabel = [[UILabel alloc]initWithFrame:kCR(, imageScroll.bottom - , , )];
imageNumLabel.text = @"1/6";
imageNumLabel.textAlignment = NSTextAlignmentCenter;
imageNumLabel.textColor = [UIColor whiteColor];
imageNumLabel.backgroundColor = [UIColor clearColor];
[theScrollView addSubview:imageNumLabel];
[imageNumLabel release];

3: ScrollView的代理

#pragma mark Scroll delegate
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;{
int currentPage = floor((scrollView.contentOffset.x - scrollView.frame.size.width / ) / scrollView.frame.size.width) + ;
imageNumLabel.text = [NSString stringWithFormat:@"%d/6",currentPage + ];
//imageScroll.transform = CGAffineTransformMakeScale(1,1);
if (currentPage==) {
[scrollView setContentOffset:CGPointMake(, ) animated:NO];
imageNumLabel.text = [NSString stringWithFormat:@"%d/6",];
}
}

UIScrollView 图片循环滚动的更多相关文章

  1. 使用UIScrollView 结合 UIImageView 实现图片循环滚动

    场景: 在开发工作中,有时我们需要实现一组图片循环滚动的情况.当我们使用 UIScrollView 结合 UIImageView 来实现时,一般 UIImageView 会尽量考虑重用,下面例子是以( ...

  2. cocos2d(背景图片循环滚动)

    背景图片循环滚动 使用action 实现的: 主要有两个背景图片交替循环滚动:我选的两个背景图片的宽度都是1024的 ,所以定义了#define BGIMG_WIDTH 1024 代码如下: 在Hel ...

  3. 基于html5可拖拽图片循环滚动切换

    分享一款基于html5可拖拽图片循环滚动切换.这是一款支持手机端拖拽切换的网站图片循环滚动特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div id="s ...

  4. 特殊例子--JavaScript代码实现图片循环滚动效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. 图片循环滚动效果shader

    背景无限循环滚动效果,有X和Y轴的速度控制,方便控制.见下图,操作步骤同之前的背景循环设置. shader如下: Shader "Custom/Scroll" { Properti ...

  6. UIScrollView现实循环滚动

    #import "RootViewController.h" #define width [UIScreen mainScreen].bounds.size.width #defi ...

  7. iOS 图片循环滚动(切片效果)

                             #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIAp ...

  8. JS实现鼠标移上去图片停止滚动移开恢复滚动效果

    这是在做个人站的时候展示项目成果,因为不光需要展示,还需要介绍详细内容,就在滚动展示的地方做了这个效果以便于点开想要看的项目. 首先,要做的是一个需要滚动的区域.我前边写过一个关于图片循环滚动的示例, ...

  9. UIScrollView循环滚动1

    现在基本每一个商业APP都会有循环滚动视图,放一些轮播广告之类的,都是放在UIScrollView之上.假如我要实现N张图片的轮播,我借鉴了几个博文,得到两种方法实现: [第一种]:如下图(图片来源于 ...

随机推荐

  1. js异步任务处理方式

    一.es6(es2015)之前:使用原始的callback函数,会陷入回掉地域 this.$http.jsonp('/login', (res) => { this.$http.jsonp('/ ...

  2. ISO7816 (part 1-3) asynchronous smartcard information

    http://java.inf.elte.hu/java-1.3/javacard/iso7816.txt ============================================== ...

  3. OPC服务器开发浅谈 — 服务器模型(转)

    这里主要讨论的是OPC Data Access 2.0服务器的开发,在掌握了这个最常用的OPC服务器开发之后,对其它类型的OPC服务器,如A&E.HDA等就可以触类旁通了. 一个OPC服务器的 ...

  4. 关于Hyper-V备份的四大注意事项

    尽管Hyper-V备份相对简单,但备份管理员仍需注意四大问题.这四方面的问题在创建备份时可能不太重要,但在备份恢复时影响甚大. 1.对于虚拟机来说不仅意味着虚拟磁盘 就目前来看,企业在执行Hyper- ...

  5. MVC文件上传07-使用客户端jQuery-File-Upload插件和服务端Backload组件裁剪上传图片

    本篇通过在配置文件中设置,对上传图片修剪后保存到指定文件夹. 相关兄弟篇: MVC文件上传01-使用jquery异步上传并客户端验证类型和大小  MVC文件上传02-使用HttpPostedFileB ...

  6. andriod 获得MP4时长

    //获得MP4时长 private int getTimeLong(String videoPath) { MediaMetadataRetriever retr = new MediaMetadat ...

  7. 通过使用第三方开源jar包sigar.jar我们可以获得本地的信息

    1.下载sigar.jar sigar官方主页 sigar-1.6.4.zip 2.按照主页上的说明解压包后将相应的文件copy到java路径.比如windows32位操作系统需要将lib中sigar ...

  8. tomcat启动时间修改

    Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires ...

  9. Glusterfs初试

    Gluster的模式及介绍在此不表,这里只记录安装及配置过程. 1.整体环境 server1 : gfs1.cluster.com server2 : gfs2.cluster.com Client: ...

  10. kafka-manager:kafak的管理界面的安装和使用

    下载打包 release下载:https://github.com/yahoo/kafka-manager/releases 源码位置:https://github.com/yahoo/kafka-m ...