ios中滚动页面
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
int width=frame.size.width;
int height=frame.size.height;
scrollview=[[UIScrollView alloc] initWithFrame:CGRectMake(, , width, height)];
[self addSubview:scrollview];
for (int i=; i<; i++) {
UIImageView *imageview=[[UIImageView alloc] initWithFrame:CGRectMake(i*width, , width, height)];
imageview.image=[UIImage imageNamed:[NSString stringWithFormat:@"image%zi@2x.jpg",(i+)]];
[scrollview addSubview:imageview];
}
scrollview.contentSize=CGSizeMake(*width, height);
scrollview.pagingEnabled=YES;
scrollview.showsVerticalScrollIndicator=NO;
scrollview.showsHorizontalScrollIndicator=NO;
scrollview.delegate=self;
scrollview.bounces=NO; pagecontroller=[[UIPageControl alloc] initWithFrame:CGRectMake((width-)*0.5f, height--, , )];
[self addSubview:pagecontroller]; pagecontroller.currentPage=;
pagecontroller.numberOfPages=;
currentPage=; self.timer=[NSTimer scheduledTimerWithTimeInterval: target:self
selector:@selector(timer:) userInfo:nil repeats:YES];
[self.timer fire]; }
return self;
} -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGFloat width=self.bounds.size.width;
CGPoint point=scrollview.contentOffset;
CGFloat offenx=point.x;
pagecontroller.currentPage=offenx/width;
} -(void)timer:(NSTimer *)time{
if (currentPage>) {
currentPage=;
}
CGFloat width=self.bounds.size.width;
[UIView beginAnimations:nil context:nil];
scrollview.contentOffset=CGPointMake(currentPage*width, );
pagecontroller.currentPage=currentPage;
[UIView commitAnimations];
currentPage++;
}
ios中滚动页面的更多相关文章
- vue中滚动页面,改变样式&&导航栏滚动时,样式透明度修改
		
vue中滚动页面,改变样式&&导航栏滚动时,样式透明度修改.vue <div class="commonHeader" v-bind:class=" ...
 - ios中iframe页面出现白屏问题
		
最近用ionic3开发的一个项目在ios中出现了白屏的问题 banner轮播图跳转网页 使用了iframe 但是却时不时的出现白屏现象 在android中一切正常 网上查资料发现 是因为ios不允许访 ...
 - iOS 中 h5 页面 iframe 调用高度自扩展问题及解决
		
开发需求需要在 h5 中用 iframe 中调用一个其他公司开发的 html 页面. 简单的插入 <iframe /> 并设置宽高后,发现在 Android 手机浏览器上打开可以正常运行, ...
 - [原]iOS中 Web 页面与 Native Code 的一种通信方式
		
在 iOS 开发中,Web 页面与 Native Code 通信可以分为两个方面: 1.Native Code 调用 Web 页面的方法:主要是调用页面中的 Javascript 函数. 2.Web ...
 - iframe ios中h5页面 样式变大
		
实际项目开发中,iframe在移动设备中使用问题还是很大的,说一说我的那些iframe坑 做过的这个后台管理框架,最开始的需求是PC,但随着业务需要,需要将项目兼容到ipad,后台的框架也是使用的开源 ...
 - ios中开始页面做法
		
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launc ...
 - ios系统微信浏览器、safari浏览器中h5页面上拉下滑导致悬浮层脱离窗口的解决方法
		
一. 运行环境: iphone所有机型的qq浏览器,safari浏览器,微信内置浏览器(qq浏览器内核)等. 二. 异常现象: 1. 大幅度上下滑动h5页面,然后停止滑动,有时候会影响到页面滚动,如局 ...
 - css 移动端页面,在ios中,margin-bottom 没有生效
		
在开发中,你会遇到各种美轮美奂的UI交互设计图,下面这种UI图,我在开发时就在布局上遇到一个小问题 问题现象:ios 手机滚动到底部,底部的margin-bottom不生效,Android手机和模拟器 ...
 - 阻止iOS中页面弹性回滚,只允许div.phone_body的区块有弹性
		
使用说明:只要替换选择器:var selector = '.phone_body'; /** * 阻止iOS中页面弹性回滚,只允许div.scroller的区块有弹性 */ (function () ...
 
随机推荐
- SharePoint SPListItem   权限设置
			
namespace Microsoft.SharePoint { using System; using System.Text; using System.Collections.Generic; ...
 - Datetimepicker配置参数
			
jquery的datetimepicker时间控件除了样式有点不太美观,功能性还是相当强大的. 在正常情况下input的type应该设置为"text",可点击又可输入(mask,e ...
 - 【Spark】SparkStreaming-输出到Kafka
			
SparkStreaming-输出到Kafka sparkstreaming output kafka_百度搜索 SparkStreaming采用直连方式(Direct Approach)获取Kafk ...
 - Linux下逻辑地址-线性地址-物理地址图解(转)
			
一.逻辑地址转线性地址 机器语言指令中出现的内存地址,都是逻辑地址,需要转换成线性地址,再经过MMU(CPU中的内存管理单元)转换成物理地址才能够被访问到. 我们写个最简单的hello world程序 ...
 - Everything常见问题及搜索技巧,附Demo
			
1 Everything 1.1 "Everything"是什么? "Everything"是一个运行于Windows系统,基于文件.文件夹名称的快速搜索引擎. ...
 - 4444: [Scoi2015]国旗计划|贪心|倍增
			
由于没有区间被其它区间包括这个条件,也就是假设li<lj那么一定满足ri<rj,就能够贪心搞一搞了. 假如区间[l,r]都已经被覆盖,那么能够继续找一个li在[l,r]范围内的最大的一个, ...
 - [Functional Programming] Create Reusable Functions with Partial Application in JavaScript
			
This lesson teaches you how arguments passed to a curried function allow us to store data in closure ...
 - 在SpringTest中将Mockito的mock对象通过spring注入使用
			
转载:https://blog.csdn.net/m0_38043362/article/details/80111957 1. 原理介绍 通过BeanFactoryPostProcessor向Bea ...
 - 一些常用&实用的Linux命令
			
这些指令还是很常用的,最起码有些我每天都要用.当然,很多东西还是写成shell脚本用起来更方便. man 命令(查看一个命令的详细帮助信息) 命令 --help(显示一个命令的简单帮助信息) 命令 | ...
 - Camtasia Studio CamStudio如何不录制鼠标
			
在录制的小窗口中,点击Effects-Options,然后Cursor里面取消勾选Make cursor effects 可能会报错说请选择有效的声音文件 在Sound里面选择一个有效的目录,不能 ...