keyboard splitting bug on ipad with ios 5 and 6 (Cocos2d-x)
Had the same issue - the solution is to stop the opengl layer from rendering while this is happening. Here’s what I did:
1) Register for keyboard frame change events at start of application. I did this in AppController.mm
- (BOOL)application:(UIApplication
*)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
[[NSNotificationCenterdefaultCenter]
addObserver:self
selector:@selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification
object:nil];//UIKeyboardWillChangeFrameNotification
[[NSNotificationCenterdefaultCenter]
addObserver:self
selector:@selector(keyboardDidChangeFrame:)
name:UIKeyboardDidChangeFrameNotification
object:nil];
...
}
2) Started and stopped rendering during keyboard animation.
-(void)keyboardWillChangeFrame:(NSNotification *)notification {
NSLog(@"keyboardWillChangeFrame");
// stop openGL animation while animating keyboard
cocos2d::CCDirector::sharedDirector()->stopAnimation();
}
-(void)keyboardDidChangeFrame:(NSNotification *)notification {// restart openGL animation
when keyboard stops animating
cocos2d::CCDirector::sharedDirector()->startAnimation();
}
上面是从google上搜出来的答案,百度找了非常久没找到答案。 :《 google常常不好用。。。
okay,到眼下为止。键盘分拆,浮动,收回动作能够完美展现。可是出现了一点瑕疵,键盘收起时,会出现输入框中的字有闪烁,以挑剔的眼光来说,这是个问题:
看上面代码,在键盘出现变化时。停止全部的动画。键盘结束时继续,debug后发现就是在动画停止的时候文字消失。開始动画后出现。
推断是由于控件儿在停止编辑事件/键盘收起事件中有又一次设置文字信息。
经过查找:在CCEditBoxImplIOS.mm中发现了---
- (BOOL)textFieldShouldEndEditing:(UITextField *)sender
{
CCLOG("textFieldShouldEndEditing...");
editState_ =
NO;
getEditBoxImplIOS()->setText(getEditBoxImplIOS()->getText());
cocos2d::extension::CCEditBoxDelegate* pDelegate =
getEditBoxImplIOS()->getDelegate();
if (pDelegate != NULL)
{
pDelegate->editBoxEditingDidEnd(getEditBoxImplIOS()->getCCEditBox());
pDelegate->editBoxReturn(getEditBoxImplIOS()->getCCEditBox());
}
cocos2d::extension::CCEditBox* pEditBox=
getEditBoxImplIOS()->getCCEditBox();
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
{
cocos2d::CCScriptEngineProtocol* pEngine =
cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(),
"ended",pEditBox);
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(),
"return",pEditBox);
}
if(editBox_ !=
nil)
{
// getEditBoxImplIOS()->onEndEditing(); //就是这里,onEndEditing又一次给设置内容了,似乎内容没有不论什么的变化
}
return
YES;
}
void
CCEditBoxImplIOS::onEndEditing()
{
m_systemControl.textField.hidden =
YES;
if(strlen(getText()) == 0)
{
m_pLabel->setVisible(false);
m_pLabelPlaceHolder->setVisible(true);
}
else
{
m_pLabel->setVisible(true);
m_pLabelPlaceHolder->setVisible(false);
setInactiveText(getText());
}
}
凝视掉textFieldShouldEndEditing方法。发现画面不再闪烁。 下班以后。。
。。 汗一个。这个问题从事几乎相同2天,再次感谢google,假如还找不到信息。关于疯狂
暂时还没有发现任何问题。我们欢迎评论!
keyboard splitting bug on ipad with ios 5 and 6 (Cocos2d-x)的更多相关文章
- iOS手势学习UIGestureRecognizer & cocos2d 手势推荐
iOS手势学习UIGestureRecognizer & cocos2d 手势推荐 手势识别类型: UILongPressGestureRecognizer // 长按UIPanGestur ...
- [BUG]微信小程序ios时间转换
描述 小程序ios new Date('2019-08-14T08:00:00.000+0000') 显示为 <Date: null>. '2019-08-14T08:00:00 ...
- iPhone 和 iPad的ios 开发中 利用 WebViewJavascriptBridge组件,通过 UIWebView 对Html进行双向通讯
本文转载至 http://blog.csdn.net/remote_roamer/article/details/7261490 WebViewJavascriptBridge 项目的 官网 http ...
- 移动端上传照片 预览+Draw on Canvas's Demo(解决 iOS 等设备照片旋转 90 度的 bug)
背景: 本人的一个移动端H5项目,需求如下: 需求一:手机相册选取或拍摄照片后在页面上预览 需求二:然后绘制在canvas画布上 这里,我们先看一个demo(http://jsfiddle.net/q ...
- iOS Orientation bug
Every September means pain for iOS developers- you need to make sure your old apps/code run on the n ...
- iOS 之 调试、解决BUG
iOS 解决一个复杂bug 之 计分卡 iOS 调试 之 打印 iOS 错误之 NSObject .CGFloat iOS bug 之 H5 页面没有弹出提示框 iOS 日志工具 CocoaLumbe ...
- 周记3——解决fixed属性在ios软键盘弹出后失效的bug
这周在做空间(“类似”qq空间)项目.首页是好友发表的说说,可以针对每条说说进行评论,评论框吸附固定在屏幕底部.此时,Bug来了...在ios上,软键盘弹出后fixed属性失效了.后来发现,ios绝大 ...
- iOS平台iPhone和iPad免费开放源代码游戏案例列表
此页面列表收集的是一些iPhone和iPad等iOS操作系统的开放源代码(Open Source)游戏.这些iOS开源游戏都是曾经或正发布在App Store.列表中的这些iOS开源游戏都是使用主流的 ...
- 【Openvpn】iOS OpenVPN客户端设置指南(适用iPhone/iPad)
适用于iPhone/iPad/这些iOS设备.之前iOS使用OpenVPN是需要越狱的,并且是付费第三方应用. 去年开始OpenVPN官方推出了iOS客户端就好用多了,免费也无需越狱. 说明:如果是新 ...
随机推荐
- Easy 2048 Again - ZOJ 3802 像缩进dp
Easy 2048 Again Time Limit: 2 Seconds Memory Limit: 65536 KB Dark_sun knows that on a single-tr ...
- [笔记] C# Windows Phone 8 WP8 开发,判断目前网路是否可用。
原文:[笔记] C# Windows Phone 8 WP8 开发,判断目前网路是否可用. 常常我们在开发Windows Phone 8 App时会使用网路来读取网页的资料或其他开放平台的Json.X ...
- 破解win2008r2服务器域用户名
启动PE系统 进入 cmd窗口 cd 进入 win2008r2服务器的安装盘(假设为d:) d: cd windows/system32 ren osk.exe osk02.exe #重命令屏幕键盘 ...
- Swift新手教程3-字符串String
原创blog,转载请注明出处 String 在swfit中,String兼容Unicode的方式.用法和C语言类似. 注意 在Cocoa和Cocoa touch中,Swift的String,和Fo ...
- 在汉澳sinox2014建立ZFS高可靠文件存储系统
在汉澳sinox2014建立ZFS高可靠文件存储系统 汉澳sinox2014能够用比較小的固态硬盘安装,文件系统能够用zfs系统存放. 请准备一些硬盘,比方三块SCSI硬盘:da0,da1,da2 如 ...
- ListView嵌套GridView显示不完整的解决方案
转载注明出处:http://blog.csdn.net/allen315410/article/details/40152987 近期在做项目中,有个模块须要在ListView中嵌套一个GridVie ...
- memset功能的具体说明
1.void *memset(void *s,int c,size_t n)总的效果:内存空间开辟了 s 第一 n 字节的值设置为一个值 c. 2.样本#include void main(){cha ...
- jQuery Validate插入 reomte使用详细的说明
在用户注冊时常常要通过ajax请求推断用户账号是否已注冊,最方便的方法便是用jQuery Validate插件 reomte方法 Jquery Validate插件, 调用远程方法验证參数, remo ...
- 发展,需求驱动 · 一间 所见即所得
从需求不是一句空话.同样是在发展过程中真正的. 需求驱动,与极限编程的一些想法和测试驱动开发基本重合. 鉴于该网站的发展是一个比较流行的方向,我会从网站开始,阐述自己的"需求驱动的发展&qu ...
- FastDFS设备、构造、配置()一-安装和部署
FastDFS是一个开源的.高性能的的分布式文件系统,他基本的功能包含:文件存储.同步和訪问,设计基于高可用和负载均衡,FastDFS很适用于基于文件服务的站点.比如图片分享和视频分享站点 FastD ...