设为首页 加入收藏

TOP

iOS— UIScrollView和 UIPageControl之间的那些事(二)
2017-10-12 18:17:05 】 浏览:2929
Tags:iOS UIScrollView UIPageControl 之间 那些
[self.imageArray objectAtIndex:self.currentPage+1]; 77 } 78 79 self.firstimage.frame=CGRectMake(0, 0, WIDTH, HEIGHT); 80 self.secondimage.frame=CGRectMake(WIDTH, 0, WIDTH, HEIGHT); 81 self.thirimage.frame=CGRectMake(WIDTH*2, 0, WIDTH, HEIGHT); 82 83 [self.myScrollView addSubview:self.firstimage]; 84 [self.myScrollView addSubview:self.secondimage]; 85 [self.myScrollView addSubview:self.thirimage]; 86 87 self.myScrollView.contentOffset=CGPointMake(WIDTH, 0); 88 } 89 90 #pragma mark scrollView Delegate 91 //在滚动结束状态转换 92 -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 93 { 94 float x=self.myScrollView.contentOffset.x; 95 96 // 向左 97 if (x<0||x==0) { 98 if (self.currentPage==0) { 99 self.currentPage=(int)self.imageArray.count-1; 100 }else{ 101 self.currentPage--; 102 } 103 } 104 105 // 向右 106 if (x>2*WIDTH||x==2*WIDTH) { 107 if (self.currentPage==(int)self.imageArray.count-1) { 108 self.currentPage=0; 109 }else{ 110 self.currentPage++; 111 } 112 } 113 114 self.myPageControl.currentPage=self.currentPage; 115 [self reloadImage]; 116 } View Code

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Objective-c 深浅复制 下一篇iOS-UIScrollView和UIPageControl..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目