- 本帖最后由 andyzhanchen 于 2013-5-12 18:04 编辑 *
默认横屏模式(分辨率为960640),欲调整为竖屏模式(640960),通过以下代码操作之后切换到竖屏模式显示不完整,且触摸位置也乱掉,切回横屏模式均正确,资源适配分辨率为960*640,还请各位大神指教,问题出在何处,
-x部分代码
//iWidth,iHeight为旋转后的屏幕分辨率(pix)
CCEGLView::sharedOpenGLView()->setFrameSize(iWidth,iHeight);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(iWidth,iHeight,kResolutionShowAll);CCDirector::sharedDirector()->setContentScaleFactor(1.0f);
ios转屏代码void SetScreenOrientation(int iOrientation){ RootViewController rootViewController = viewController]; rootViewController.m_iOrientation = iOrientation; UIView view = rootViewController.view; CGFloat duration = .statusBarOrientationAnimationDuration; ; ; CGAffineTransform transform; UIInterfaceOrientation orientation = .statusBarOrientation; if(iOrientation == 0)//转为横屏 { if(orientation != UIInterfaceOrientationMaskLandscape) { setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES]; transform = CGAffineTransformMakeRotation(M_PI/2); view.transform = transform; ; } } else if(iOrientation == 1)//转为竖屏 { if(orientation != UIInterfaceOrientationPortrait) { setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES]; transform = CGAffineTransformIdentity; view.transform = transform; ; } } }