iphone - 添加导航按钮在钛合金中第一次不起作用

标签 iphone navigation titanium-mobile titanium-alloy

我在导航中添加了导航按钮,并在其上编写了“点击”功能,但第一次它不起作用。实际上,我在第一次单击时向导航栏添加按钮,但在第二次单击时不起作用,它起作用了,我该如何解决这个问题

我的xml代码是

 <Alloy>
<Window id="aboutWin" name="aboutWinName">
    <NavigationGroup id="navAbout" platform="ios">
        <Window class="container" id="aboutChildWin">
        <View id="aboutView">
        <ImageView id="logoImg"></ImageView>
        <ImageView id='logoWrd'></ImageView>
        <Label id="versionLbl"></Label>
        </View>
    <View id="footView"></View>
    </Window>
    </NavigationGroup>
</Window>
 </Alloy>

我的Js代码是

var button = Titanium.UI.createButton({
// title:"Back",
backgroundImage:"/images/MenuList.png",
// top : 4.5,
height : 35,
width : 40,
// left : 4
})


$.aboutChildWin.leftNavButton = button;


button.addEventListener('click',function(){
 if(Ti.App.currentAnimateWindow  == "About")
 {
     Ti.App.socialWindow.hide();
     Ti.App.menuWindow.show();
     $.aboutWin.animate(animateLeft);
     Ti.App.currentAnimateWindow  = "Menu";
 }
 else if(Ti.App.currentAnimateWindow  == "Menu")
 {
     $.aboutWin.animate(animateRight);
     Ti.App.currentAnimateWindow  = "About";
 }

})

谁能解决这个问题

最佳答案

我只是做了一些小改动,将添加按钮插入到导航窗口中,我将导航按钮添加到整个窗口。

代码是:

$.aboutWin.leftNavButton = button;

关于iphone - 添加导航按钮在钛合金中第一次不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14929932/

相关文章:

jquery - iPhone 故障,将 div 完美地移动到上面的 div

iphone - 我的导航 Controller 需要在 iOS5 中按两次后退?

html - 页面导航 - 带有 knockout.js 的 jQuery Mobile

Titanium 向 View 添加标签

Titanium 如何将一个窗口推送到另一个具有推送 View Controller 效果的窗口(像iPhone中的动画)

iphone - 在制作动画时应用 CAAnimation 的更改

iphone - 无法在 Android 或 iPhone 上手动滚动 div

backbone.js - 合金数据绑定(bind)找不到集合

iphone - iPad 模拟器窗外的电视在横向模式下消失

silverlight - 如何使用 MVVM 在 Silverlight 4.0 中执行导航?