- iOS 升级到13后,新出了一个深色模式。然后用Cocos creator开发的软件,用到EditBox输入时,字体的颜色为白色,这样就基本上看不清了。解决办法在ios工程下修改二行代码
- 找到文件
jsb-default/frameworks/cocos2d-x/cocos/ui/edit-box/EditBox-ios.mm,找到二处initTextField中添加g_textField.textColor = [UIColor blackColor]
void initTextField(const CGRect& rect, const cocos2d::EditBox::ShowInfo& showInfo)
{
if (! g_textField)
{
g_textField = [[UITextField alloc] initWithFrame:rect];
[g_textField setBorderStyle:UITextBorderStyleLine];
// 添加textColor值为黑色
g_textField.textColor = [UIColor blackColor]
g_textField.backgroundColor = [UIColor whiteColor];
void initTextView(const CGRect& viewRect, const CGRect& btnRect, const cocos2d::EditBox::ShowInfo& showInfo)
{
if (!g_textView)
{
g_textView = [[UITextView alloc] initWithFrame:btnRect];
// 添加textColor值为黑色
g_textView.textColor = [UIColor blackColor]
// 这里要添加背景色为白色,不然多行输入会有问题
g_textView.backgroundColor= [UIColor whiteColor]
g_textViewDelegate = [[TextViewDelegate alloc] init];
g_textView.delegate = g_textViewDelegate;
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。