ipheone scrollview自动滑动 如题,如何让scrollview能自动滑动,不用手触就可以自己循环滑动 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 起个定时器 里边用setContentOffset 我加了定时器了,但是他只是从自动滑动到2,之后就不在自动滑动了,需要我手触 NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO]; - (void) handleTimer: (NSTimer *) timer{ [scrollView setContentOffset:CGPointMake(320, 0) animated:YES]; } CGPointMake(320, 0)把坐标设置成变量,每次在促发定时器的时候为这个变量上加一个特定的值,如果超过了你设定的最大值就归0就可以了啊 我加了个循环啊,还是第一页滚动- (void) handleTimer: (NSTimer *) timer{ for (unsigned j=320; j<pNum; j++) { [scrollView setContentOffset:CGPointMake(j, 0) animated:YES]; } } 别在定时器里放循环啊~假设 你的pNum = 2000你该在定时器里写if (xPoint > 2000) xPoint = 0xPoint += 320[scrollView setContentOffset:CGPointMake(xPoint, 0) animated:YES]; 然后定时器的时间间隔长一点 ......打log看下xPoint的值的变化规律 NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(handleTimer:) userInfo:nil repeats:YES]; repeats:NO 改成 repeats:YES 设置定时器,不断改变scrollview的位置,ok 求助 ios关于opengl es 2.0 vbo glDrawArrays函数 怎么做移动云平台 横屏的工程如何使电池余量、时间、网络信号等信息在屏幕左端,如何让始终位于顶端吗? 关于在多个View窗口切换的问题,请教大家 关于Channel*报 Expected a type 错误 偶像应用--My-Idols Xcode编译问题 iOS开发:一个奇怪的问题 Xcode6运行ios8的项目屏幕右侧不显示内容 tableview添加手势后,怎样同时保证它本身的滚动。 通过IP访问控制主机 急。。请问如何取得safari的bookmark列表
我加了定时器了,但是他只是从自动滑动到2,之后就不在自动滑动了,需要我手触
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.25
target:self
selector:@selector(handleTimer:)
userInfo:nil
repeats:NO];
- (void) handleTimer: (NSTimer *) timer
{
[scrollView setContentOffset:CGPointMake(320, 0) animated:YES];
}
我加了个循环啊,还是第一页滚动
- (void) handleTimer: (NSTimer *) timer
{
for (unsigned j=320; j<pNum; j++) {
[scrollView setContentOffset:CGPointMake(j, 0) animated:YES];
}
}
xPoint = 0xPoint += 320[scrollView setContentOffset:CGPointMake(xPoint, 0) animated:YES]; 然后定时器的时间间隔长一点
target:self
selector:@selector(handleTimer:)
userInfo:nil
repeats:YES];