(转) cocos 里面scrollView一些方法
void setBounceEnabled (bool enabled)
设置当滚动到边界时,是否内部容器发生弹回(bounce)效果
bool isBounceEnabled () const
获取边界弹回(bounce)状态。
void setInertiaScrollEnabled (bool enabled)
设置是否开启滚动惯性。
bool isInertiaScrollEnabled () const
获取滚动视图是否开启滚动惯性。
void setScrollBarEnabled (bool enabled)
设置是否启用滚动条。
bool isScrollBarEnabled () const
返回滚动条是否启用。
virtual void setDirection (Direction dir)
改变滚动视图的方向。
Direction getDirection () const
获取滚动视图的滚动方向。
Layout * getInnerContainer () const
获取滚动视图的内部布局容器,该布局容器为滚动视图的子节点。
//与滚动方位有关
void scrollToPercentVertical (float percent, float second, bool attenuated)
按百分比竖直滚动内部布局容器
void scrollToPercentHorizontal (float percent, float second, bool attenuated)
按百分比水平滚动内部布局容器
void scrollToPercentBothDirection (const Vec2 &percent, float second, bool attenuated)
在竖直方向和水平方向分别按一定的百分比滚动内部布局容器
void scrollToBottom (float second, bool attenuated)
将内部的布局容器滚动到滚动视图的底部边界。
void scrollToTop (float second, bool attenuated)
将内部布局容器滚动到滚动视图的顶部边界。
void scrollToLeft (float second, bool attenuated)
将内部容器滚动到滚动视图的左端边界
void scrollToRight (float time, bool attenuated)
将内部布局容器滚动到滚动视图的右端边界
void scrollToTopLeft (float second, bool attenuated)
滚动内部布局容器到滚动视图的左上角
void scrollToTopRight (float time, bool attenuated)
滚动内部布局容器到滚动使徒的右上角
void scrollToBottomLeft (float second, bool attenuated)
滚动内部布局容器到视图的左下角
void scrollToBottomRight (float time, bool attenuated)
滚动内部布局容器到视图的右下角
//与滚动条样式有关
void setScrollBarPositionFromCorner (const Vec2 &positionFromCorner)
设置滚动条水平位置和垂直位置。
void setScrollBarPositionFromCornerForVertical (const Vec2 &positionFromCorner)
设置滚动条垂直位置。
Vec2 getScrollBarPositionFromCornerForVertical () const
获得滚动条垂直位置。
void setScrollBarPositionFromCornerForHorizontal (const Vec2 &positionFromCorner)
设置滚动条水平位置。
Vec2 getScrollBarPositionFromCornerForHorizontal () const
获得滚动条水平位置。
void setScrollBarWidth (float width)
设置滚动条宽度。
float getScrollBarWidth () const
获取滚动条宽度。
void setScrollBarColor (const Color3B &color)
设置滚动条颜色。
const Color3B & getScrollBarColor () const
获取滚动条颜色。
void setScrollBarOpacity (GLubyte opacity)
设置滚动条透明度。
GLubyte getScrollBarOpacity () const
获取滚动条透明度。
void setScrollBarAutoHideEnabled (bool autoHideEnabled)
设置滚动条自动隐藏状态。
bool isScrollBarAutoHideEnabled () const
获取滚动条是否自动隐藏。
void setScrollBarAutoHideTime (float autoHideTime)
设置滚动条自动隐藏时间。
float getScrollBarAutoHideTime () const
获取滚动条是否自动隐藏。
//
void jumpToBottom ()
将内部布局容器移至视图底端。
void jumpToTop ()
将内部布局容器移至视图顶端。
void jumpToLeft ()
将内部布局容器移至视图左端。
void jumpToRight ()
将内部布局容器移至视图右端。
void jumpToTopLeft ()
将内部布局容器移至视图的左上角。
void jumpToTopRight ()
将内部布局容器移至视图的右上角。
void jumpToBottomLeft ()
将内部布局容器移至视图的左下角。
void jumpToBottomRight ()
将内部布局容器移至视图的右下角。
void jumpToPercentVertical (float percent)
按一定的百分比竖直滚动视图内的布局容器。
void jumpToPercentHorizontal (float percent)
按一定的百分比竖直滚动视图内的布局容器。
void jumpToPercentBothDirection (const Vec2 &percent)
竖直方向和水平方向分别按一定的百分比滚动容器。
void setInnerContainerSize (const Size &size)
设置滚动容器的滚动区域大小。
const Size & getInnerContainerSize () const
获取滚动容器的滚动区域大小。
void setInnerContainerPosition (const Vec2 &pos)
设置容器内的位置。
const Vec2 getInnerContainerPosition () const
获取容器内的位置。
void addEventListenerScrollView (Ref *target, SEL_ScrollViewEvent selector)
添加一个回调函数,该回调函数将会在视图发生滚动时触发。
virtual void addEventListener (const ccScrollViewCallback &callback)
添加一个回调函数,该回调函数将在滚动事件触发时被调用。
(转) cocos 里面scrollView一些方法的更多相关文章
- Cocos Creator scrollview添加事件的两种方法
scrollview添加事件 方法一这种方法添加的事件回调和使用编辑器添加的事件回调是一样的,通过代码添加, 你需要首先构造一个 cc.Component.EventHandler 对象,然后设置好对 ...
- cocos creator ScrollView组件scrollToOffset()方法的使用
前言 之前想用scrollToOffset()在打开界面时,滑动窗口滑动到一个相对应的位置,但是使用scrollToOffset()这个方法的时候,没起作用.然后就用了其他方法来实现相同的效果.现在有 ...
- 【iOS发展-53】实例探究:scrollView使用方法和解决方案无法滚动核心
案例效果: (1)基本的就是练习scrollView的使用方法.界面里面的其它元素基本都是UIView和UIButton堆砌起来的. (2)主要用代码实现.当然,能够先用storyboard拖个scr ...
- 两种让tableview返回顶部的方法
1. [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:_currentRow inSection:0] animat ...
- IOS ScrollView放大缩小点击位置并居中
项目中的一个优化案例,提升用户体验,对地铁线路图点击放大.缩小,并且点击位置居中: 正常ScrollView 我们点击某一点比如屏幕右侧,想要点的位置向左移动到中心位置,很简单只有算出该点位置距中心位 ...
- Android中scrollview嵌套HorizontalScrollView卡顿现象解决
开发中经验会遇到滑动里面嵌入滑动的问题,但是这种情况下触摸事件就会发生冲突.导致滑动非常卡,甚至出现程序停止响应.这种情况下我们一般需要重写view.下面给出重新scrollview的方法 publi ...
- [ios]scrollView实现移动与缩放
实现滑动 1.在viewDidLoad中对scrollview的contentSize属性赋值 告诉他滑动范围. 实现缩放 1.在storyboard的scrollview的attribute标签中设 ...
- React-Native的基本控件属性方法
对React-Native的学习,从熟悉基本控件开始. View 属性方法 序号 名称 属性Or方法 类型 说明 1 accessibilityLabel 属性 string 2 accessib ...
- 如何禁止scrollView 的子控件自动滑到 底部或者中间部分
现象:当一个scrollView 里面包含很多childView,并且整个界面超出屏幕的范围,而且每个childView都获取焦点,scrollView就会自动滑到底部或者中间部分. 可以使用以下几种 ...
随机推荐
- 国内镜像pip
建议非清华大学校内的使用这个镜像: http://e.pypi.python.org/simple(这也是一个http://pypi.v2ex.com/simple),清华校内的就使用这个:http: ...
- CodeForces 547E:Mike and Friends(AC自动机+DFS序+主席树)
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercas ...
- BZOJ_1818_[Cqoi2010]内部白点 _扫描线+树状数组
BZOJ_1818_[Cqoi2010]内部白点 _扫描线+树状数组 Description 无限大正方形网格里有n个黑色的顶点,所有其他顶点都是白色的(网格的顶点即坐标为整数的点,又称整点).每秒钟 ...
- WPF 后台触发 Validate UI‘s Element
wpf中有validateRule类, 用于界面元素的验证, 如何后台去控制validateRule呢? 1. UI层要binding写好的ValidateRule,分为Binding和MultiBi ...
- Nuget:template
ylbtech-Nuget: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 作者:ylbtech出处:http://ylbtech.c ...
- openStack高可用性和灾备方案
1. 基础知识 1.1 高可用 (High Availability,简称 HA) 高可用性是指提供在本地系统单个组件故障情况下,能继续访问应用的能力,无论这个故障是业务流程.物理设施.IT软/硬件的 ...
- Spring:JdbcTemplate使用指南
Spring:JdbcTemplate使用指南 Spring:JdbcTemplate使用指南 前言: 本文指在介绍Spring框架中的JdbcTemplate类的使用方法,涉及基本的Spring反转 ...
- 「一入 Java 深似海 」系列课程
第一期 「一入 Java 深似海 」系列课程 - 第一期 第一节:Java 语言基础
- POJ 1064 Cable master (二分)
题意:给定 n 条绳子,它们的长度分别为 ai,现在要从这些绳子中切出 m 条长度相同的绳子,求最长是多少. 析:其中就是一个二分的水题,但是有一个坑,那么就是最后输出不能四舍五入,只能向下取整. 代 ...
- ACM-ICPC2018沈阳网络赛 Lattice's basics in digital electronics(模拟)
Lattice's basics in digital electronics 44.08% 1000ms 131072K LATTICE is learning Digital Electron ...