Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8894527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:31:21+00:00 2026-06-14T23:31:21+00:00

I am using XCode version 4.2 and PhoneGap version 1.5.0 to develop iOS app.

  • 0

I am using XCode version 4.2 and PhoneGap version 1.5.0 to develop iOS app. Using the following code, I was able to add tab bar on the page, but I couldn’t make it to navigate to another page on selection. I have created the tab bar using NativeControls plugin of PhoneGap.

function onDeviceReady()
{
    Cordova.exec("NativeControls.createTabBar"        
    var options = "bottom";

    window.onorientationchange = function() {
            var orientation = window.orientation;

            switch(orientation) {
                case 0:

                Cordova.exec("NativeControls.showTabBar", options);


                /* Add a descriptive message on "Handling iPhone or iPod touch Orientation Events"  */
                document.getElementById("currentOrientation").innerHTML="Now in portrait orientation (Home button on the bottom).";
                break; 

                case 90:

                Cordova.exec("NativeControls.showTabBar", options);

                document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the left (Home button to the right).";
                break;

                case -90: 

                Cordova.exec("NativeControls.showTabBar", options);

                document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the right (Home button to the left).";
                break;

                default:

                Cordova.exec("NativeControls.showTabBar", options);

                document.getElementById("currentOrientation").innerHTML="Now the orientation must be -180. default: case: ";
                break;         
            }//end switch
        }//end window.orientationchange

        Cordova.exec("NativeControls.showTabBar", options);
        Cordova.exec("NativeControls.createTabBarItem", "Wineries", "Wineries", null, "1", options);
        Cordova.exec("NativeControls.createTabBarItem", "Wines", "Wines", "www/Wine.png", "2", {onSelect: function() {location.href = "Review.html" }});
        Cordova.exec("NativeControls.createTabBarItem", "Tours", "Tours", null, "3", options);
        Cordova.exec("NativeControls.createTabBarItem", "Non-Mobile", "Non-Mobile", null, "4", options);

        Cordova.exec("NativeControls.showTabBarItems", "Wineries", "Wines", "Tours", "Non-Mobile"); 
        Cordova.exec("NativeControls.selectTabBarItem", "Wineries");
}

But this code is not working at all for changing the page on selection.

Cordova.exec("NativeControls.createTabBarItem", "Wines", "Wines", "www/Wine.png", "2", {onSelect: function() {location.href = "Review.html" }});

EDIT Same happens when I use the following code. Should I repeat the same code on second page? If so on which method I should invoke this?

    function onDeviceReady()
    {            

        var nc = window.plugins.nativeControls;

        nc.createTabBar();
        nc.createTabBarItem("Wineries", "Wineries", "www/grape.png", {onSelect: function() {location.href = "index.html" }});
        nc.createTabBarItem("Wines", "Wines", "www/Wine.png", {onSelect: function() {location.href = "Review.html" }});
        nc.createTabBarItem("Tours", "Tours", "www/tour.png", null);
        nc.createTabBarItem("Non-Mobile", "Non-Mobile", "", null);
        nc.showTabBar();
        nc.showTabBarItems("Wineries", "Wines", "Tours", "Non-Mobile");
        nc.selectTabBarItem("Wineries");
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:31:22+00:00Added an answer on June 14, 2026 at 11:31 pm

    Just found a way around for my problem. Instead of assigning a new html page to each tab, connected it to functions. On each call, it changes the body content accordingly. But, still I would like to know if any other solution exists!!

    function onDeviceReady()
    {            
        var title = "WineWeb";
        nc = window.plugins.nativeControls;
    
        nc.createTabBar();
        nc.createTabBarItem("Wineries", "Wineries", "www/grape.png", {onSelect: Wineries});
        nc.createTabBarItem("Wines", "Wines", "www/Wine.png", {onSelect: Review});
        nc.createTabBarItem("Tours", "Tours", "www/tour.png", null);
        nc.createTabBarItem("Non-Mobile", "Non-Mobile", "", null);
        nc.showTabBar();
        nc.showTabBarItems("Wineries", "Wines", "Tours", "Non-Mobile");
        nc.selectTabBarItem("Wineries");
    }
    
    function Wineries () {
    
        nc = window.plugins.nativeControls;
        nc.setNavBarTitle("Wineries");
        nc.hideLeftNavButton();
    
        document.getElementById('Review').style.display='none';
        document.getElementById('Wineries').style.display='block';
        document.getElementById('AboutUs').style.display='none';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created iOS app using PhoneGap version 0.9.6 long back. Now I am going
I am using XCode 4.3 and I am creating a tab bar application following
I am using XCode 4.3 and I am creating a tab bar application following
I'm using Xcode version 3.2.2 but the tutorial at this site was made for
I'm using mac os lion with the latest xcode version. I installed phonegap from
I have an iOS application that was developed using Xcode Version 4.5.1. My iOS
Today I experienced a very strange behavior with my XCode (using Version 4.2, iOS
I am starting to develop apps with Phonegap, and my app runs in Xcode's
When I compile my mobile app using Xcode and Phonegap, the application on the
I'm following a tutorial for creating an animation using Xcode Version 4.5.2 in Mountain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.