2
我在钛iPhone应用程序中使用密码字段,如果用户按“?”键,我需要显示输入的密码。释放“?”后按钮和掩码密码字段按钮。我用这些代码点击“?”时如何显示输入的密码按钮
var password = Ti.UI.createTextField
({
font : {fontSize : 15, fontType: 'HaveticaL TStd', fontWeight: 'roman'},
hintText: "***************",
top : 54,
left : 107,
height : 24,
width : 153,
passwordMask : true,
color : "black",
returnKeyType : Titanium.UI.RETURNKEY_DONE,
zIndex : 5
});
我用touchstart和touchend事件用于显示密码,即设置passwordMask为假时,发生事件touchstart和重置为真时touchend事件发生。
passwordHintImg.addEventListener('touchstart',function(e){
passwordTxt.passwordMask = false;
});
passwordHintImg.addEventListener('touchend',function(e){
passwordTxt.passwordMask = true;
});
它在密码字段模糊时很好用,但如果密码字段是焦点,我按“?”按钮密码显示,我能不能隐藏显示密码