UIScroller的页面切换和上面的同步
2015-05-22 20:28
127 查看
1、点击上面的Button按钮,下面的界面随着改变
<span style="background-color: rgb(255, 255, 255);"><span style="color:#333333;">- (void)buttonAction6 { self.button1.tintColor = kcolor1; self.button2.tintColor = kcolor1; self.button3.tintColor = kcolor1; self.button4.tintColor = kcolor1; self.button5.tintColor = kcolor1; self.button6.tintColor = kcolor2; self.button7.tintColor = kcolor1; self.button8.tintColor = kcolor1; self.button9.tintColor = kcolor1;</span></span>
<span style="background-color: rgb(255, 255, 255);"><span style="color:#333333;">// 设置此时的scrollview的对应偏移量 _scrollView.contentOffset = CGPointMake(kAllWidth * 5, 0); }</span></span>
2、滑动下面的界面,让按钮的颜色对应改变
设置scrollView的代理,然后找到对应的方法,通过便宜到第几个,做出对应的处理,这里上调用对应的方法// 设置scrollView滑动结束时,进行判断 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { // p 为偏移后是第几个view NSInteger p = scrollView.contentOffset.x/scrollView.frame.size.width; if (p == 0) { [self buttonAction1]; } else if (p == 1) { [self buttonAction2]; } else if (p== 2) { [self buttonAction3]; } else if (p == 3) { [self buttonAction4]; self.scrollViewTitle.contentOffset = CGPointMake(0, 0); } else if (p == 4) { [self buttonAction5]; self.scrollViewTitle.contentOffset = CGPointMake(160, 0); }else if (p == 5) { [self buttonAction6]; } else if (p == 6) { [self buttonAction7]; } else if (p == 7) { [self buttonAction8]; } else if (p == 8) { [self buttonAction9]; } }
相关文章推荐
- 同步页面切换按钮组的实现
- android安卓 Fragment实现页面标题左右同步切换以及点击标题切换页面
- Android - 页面切换,动画播放,程序锁,Activity启动模式,利用内容观察者同步数据库变化
- Android 仿知乎日报在切换Fragment页面,按back返回时,同步修改Toolbar的title。
- IOS 视图切换 页面跳转
- Eclipse 在编辑窗口切换页面快捷键
- 属性传值(一个页面切换到下一个页面, 值的传递)
- 优化UI体验:程序启动、页面切换、数据加载、UI响应
- Android之ViewPager+Fragment实现页面点击切换和手势滑动
- https页面与Http页面自动切换-SSL解决方案
- jsp页面显示半年内的日期,两行,上面年月,下面日
- js轮播功能 标签自动切换 同页面多轮播js
- 全屏滚动,微场景,H5全屏切换滚动页面制作的方法介绍
- 页面切换成黑白,公祭日,哀悼可用
- Android ViewPager多页面滑动切换以及动画效果
- [Jquery]tab页面切换效果
- hexo生成的页面部署到git上面时报错 FATAL spawn git ENOENT
- CNZZ首页四张图片平滑切换,优化了页面代码,更有利于SEO优化
- 无刷新页面切换 - pushState
- Android开发中ViewPager实现多页面切换效果