如何在Cordova iOS项目中更改文本字段光标颜色 [英] How to change the textfield cursor colour in Cordova iOS project

查看:359
本文介绍了如何在Cordova iOS项目中更改文本字段光标颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在基于Cordova的iOS项目中有一个蓝色背景,由于我的光标在iPhone设备中无法正常显示。因此,如果有人面临这种​​情况,请告诉我如何更改Cordova iOS项目中的文本框光标颜色或任何HTML

 <$ c $ 

c>< input type =textplaceholder =First Nameid ='regFName'/>

解决方案

解决方案1: c> android:textCursorDrawable 属性到 @null 应该导致使用 android:textColor 作为光标颜色。



属性 textCursorDrawable 在API级别12及更高版本中可用

$ b解决方案2:使用iOS 7,您只需更改 tintColor 属性 UITextField 。这将影响文本光标的颜色和文本选择突出显示颜色。



您可以在代码中执行此操作...



textField.tintColor = [UIColor redColor] ;

...或在Interface Builder中:






解决方案3:在您的 EditText 属性中,属性 android:textCursorDrawable



现在设置为 @null like,



android:textCursorDrawable =@ null



现在您的 EditText Cursor 与您的 EditText TextColor






解决方案4: 使用图片和CSS游标属性,我在这里看不到任何需要的JavaScript ...

  div {
cursor:url(YOUR_IMAGE_URL),auto;
}


I have a blue background in my Cordova based iOS project due to which my cursor is not properly visible in iPhone device.So if anyone faced this please tell me How to change the textfield cursor color in Cordova iOS project or if any HTML attribute to change this tint color

textfield code in index.html:

 <input type="text" placeholder="First Name" id='regFName' />

解决方案

Solution 1: Setting the android:textCursorDrawable attribute to @null should result in the use of android:textColor as the cursor color.

Attribute textCursorDrawable is available in API level 12 and higher


Solution 2: With iOS 7 you can simply change tintColor property of the UITextField. This will affect both the color of the text cursor and the text selection highlight color.

You can do this in code...

textField.tintColor = [UIColor redColor];
... or in Interface Builder:


Solution 3: In your EditText properties, there is an attribute android:textCursorDrawable

Now set it to @null like,

android:textCursorDrawable="@null"

So now your EditText Cursor is same as your EditText TextColor.


Solution 4: Use an image along with CSS cursor property, I don't see any need of JavaScript here...

div {
   cursor: url(YOUR_IMAGE_URL), auto;
}

这篇关于如何在Cordova iOS项目中更改文本字段光标颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆