我在 appcelerator studio 中创建了一个示例合金应用程序。当我单击外部按钮(图像)时,也会执行事件。如何限制点击事件,如果我在 LeftNavButton 或 RightNavButton 之外执行事件。有谁能帮帮我。
登录.js:
$.signInWin.addEventListener('open', function() {
Ti.API.info('signInWin open');
var titleLabel = Ti.UI.createLabel({ text: 'Log In', width: Ti.UI.SIZE});
$.signInWin.setTitleControl(titleLabel);
var leftButton = Titanium.UI.createButton({
backgroundImage : '/left_arrow.png'
});
$.signInWin.setLeftNavButton(leftButton);
var rightButton = Titanium.UI.createButton({
backgroundImage : '/right_arrow.png'
});
$.signInWin.setRightNavButton(rightButton);
leftButton.addEventListener('click', function(e) {
Ti.API.info(' event performed on left button');
});
rightButton.addEventListener('click', function(e) {
Ti.API.info(' event performed on right button');
});
});
登录.tss:
"#signInWin":{
backgroundColor: '#ffffff',
}
"#signInNav":{
backgroundColor: '#00a2f7',
}
登录.xml:
<Alloy>
<NavigationWindow id="signInNav" platform="ios">
<Window id="signInWin">
</Window>
</NavigationWindow>
</Alloy>
示例屏幕视图