ScrollView
<1>
CC_SYNTHESIZE(bool,_bOpposite,BOpposite); //jn bool m_bIsChangeInnerContainerPos; // jn
<2>
_bOpposite = false; //jn m_bIsChangeInnerContainerPos = false; //jn<3>
void ScrollView::onSizeChanged() { //... if(!m_bIsChangeInnerContainerPos){ //jn 判断是不是改过位置 改过的话就不要再onsize里面初始化位置 2015-5-18 _innerContainer->setPosition(Vec2(0,_contentSize.height - _innerContainer->getContentSize().height)); } }<4>
void ScrollView::jumpToDestination(const Vec2 &des) { if(!_innerContainer->getPosition().equals(Vec2::ZERO)){ //jn新增 5-18 m_bIsChangeInnerContainerPos = true; } //... }<5>
void ScrollView::handleMoveLogic(Touch *touch) { Vec2 delta = -touch->getLocation() + touch->getPrevIoUsLocation(); switch (_direction) { case Direction::VERTICAL: // vertical { if(_bOpposite){ scrollChildren(0.0f,-delta.y); //jn 原来是:scrollChildren(0.0f,delta.y); 改动scrollview滚动方向,原来相反了。贾楠修改。 }else{ scrollChildren(0.0f,delta.y); //jn 原来是:scrollChildren(0.0f,原来相反了。贾楠修改。 } break; } case Direction::HORIZONTAL: // horizontal { scrollChildren(delta.x,0.0f); break; } case Direction::BOTH: // both { scrollChildren(delta.x,delta.y); break; } default: break; } }
ListView
<1>
public class AppActivity extends Cocos2dxActivity { //... public Cocos2dxGLSurfaceView onCreateView(){ Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); glSurfaceView.setEGLConfigChooser(5,6,5,16,8); return glSurfaceView; }