2012-03-16 3 views
0

私はiPhoneアプリケーションを作成するためにphonegapを使用していますが、ネイティブコントロールを使用してネイティブタブバーを統合しています。各タブバー項目が選択されると、ユーザーをリンクに転送します - このアプリケーションの場合、ユーザーを特定のdiv id#elementに送るつもりです。私はまた、タブバー項目の画像を使用しようとしていますが、これはどちらかの作業をしているようには見えません。tabbarアイテムをphonegapプラグインとリンクする

これまで行ってきたことは、これまでのコードは以下の通りです。

       <script type="text/javascript" charset="utf-8"> 

           function onBodyLoad() 
           { 
            document.addEventListener("deviceready",onDeviceReady,false); 
           } 

           /* When this function is called, PhoneGap has been initialized and is ready to roll */ 
           function onDeviceReady() 
           { 

            // Initializating TabBar 
            nativeControls = window.plugins.nativeControls; 
            nativeControls.createTabBar(); 

            // Item 1 tab 
            nativeControls.createTabBarItem(
                    "item1", 
                    "Item1", 
                    "/themes/images/[email protected]", 
                    {"onSelect": function() { 
                    location.href = "#section1" 
                    }} 
                    ); 

            // Item 2 tab 
            nativeControls.createTabBarItem(
                    "item2", 
                    "Item2", 
                    "/themes/images/[email protected]", 
                    {"onSelect": function() { 
                    location.href = "#section2" 
                    }} 
                    ); 

            // Item 3 tab 
            nativeControls.createTabBarItem(
                    "item3", 
                    "Item3", 
                    "/themes/images/[email protected]", 
                    {"onSelect": function() { 
                    location.href = "#section3" 
                    }} 
                    ); 

            // Item 4 tab 
            nativeControls.createTabBarItem(
                    "item4", 
                    "Item4", 
                    "/themes/images/[email protected]", 
                    {"onSelect": function() { 
                    location.href = "#section4" 
                    }} 
                    ); 

            // Item 5 tab 
            nativeControls.createTabBarItem(
                    "item5", 
                    "Item5", 
                    "/themes/images/[email protected]", 
                    {"onSelect": function() { 
                    location.href = "#section5" 
                    }} 
                    ); 

            // Compile the TabBar 
            nativeControls.showTabBar(); 
            nativeControls.showTabBarItems("mechanics", "materials", "waves", "electricity", "light"); 
            nativeControls.selectTabBarItem("mechanics"); 
           } 

           </script> 

答えて

関連する問題