(转) 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就会自动滑到底部或者中间部分. 可以使用以下几种 ...
随机推荐
- homebrew cask安装launch rocket【转】
简介 brew cask是一个用命令行管理Mac下应用的工具,它是基于homebrew的一个增强工具. homebrew可以管理Mac下的命令行工具,例如imagemagick, nodejs,如下所 ...
- POJ3237 Tree(树剖+线段树+lazy标记)
You are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbe ...
- Ubuntu 16.04 LTS 一键安装VNC
Ubuntu 16.04 LTS 安装VNC,在百度和谷歌找了很多教程,不是太老,就是说的驴唇不对马嘴,所以忍不住写一些以正视听. Ubuntu 16.04 LTS是最近出的LTS版本系统,估计未来也 ...
- UDK性能优化
转自:http://www.cnblogs.com/NEOCSL/p/3320510.html 优化问题有很多内容可讲,涉及林林总总.今天我总结一下优化注意的地方. 1.从AnimTree和Skele ...
- Stored Procedures CASE 用法错误
)) ) select @type=[type] from sys.objects with(nolock) where name=@ObjectName case @typ ...
- “MVC+Nhibernate+Jquery-EasyUI”信息发布系统 第二篇(数据库结构、登录窗口、以及主界面)
一.在上一篇文章中,主要说的就是把主框架搭建起来,并且Nhibernate能达到增删改查的地步.测试好之后再来看这篇文章,我的主框架相对来说简答一点,重点还是实现系统的功能,以及对Jquery-Eas ...
- Eclipse与IntelliJ IDEA区别
1.没有workspace,新增modules(Workspace-Project,Project-Module) 2.没有perspectives,自动根据上下文调用相关工具 3.没有保存按钮,自动 ...
- 如何阻止冒泡&&浏览器默认行为
摘要 很多同学对阻止事件冒泡和阻止事件默认行为容易混淆,项目中因为一些原因也需要阻止浏览器的一些默认行为,这里就简单总结一下. 阻止事件冒泡 什么是事件冒泡这里就不再赘述了,网上的文章一大把,这里就简 ...
- MATLAB---make与makefile简单介绍
1 make.makefile概述 makefile定义了一系列的规则,来规定哪些部分先编译,哪些部分后编译,写好makefile以后,只需一个make命令就可以让整个工程完全自动编译,所以简单的说, ...
- ubuntu18.04安装配置opencv3.4.0
1.安装配置相关工具及依赖库 sudo apt-get install build-essential # 必须的,gcc编译环境 sudo apt-get install cmake git lib ...