0
votes

I am working on Worklight version 6.1.I have created a Worklight project, added a Hybrid app and then added the iPhone environment to that application.I have generated Xcode environment and have added controller classes to that Xcode project.I have to add worklight Tab bar in my application.I am having html (web) page as the first page and from there I am navigating to view controller page.Added below function in main.js.

    var tb = WL.TabBar;
      tb.init();
      tb.addItem("One", function () {
        } ,"First",  { image : ""});
     tb.setVisible(true);
     tb.setSelectedItem("One"); 

I am able to get the Tab bar items in web page.But Tab bar is not showing in any of the view controller screen.What I should do to have Worklight Tab Bar both in web and Native ios Screen.Help me to solve this.

3
if my answer below helped you resolve your problem, please mark it as Answered.Idan Adar

3 Answers

1
votes

Worklight uses Cordova, so when you launch your application what you see is the generated Cordova Web View by Worklight.

When you navigate to a native page (in your case, a new Class), you are essentially moving away from the Web View and into another View Controller, so you will not see the WL.TabBar instance in that View Controller (the tabbar belongs to the other one).

The following blog post contains background information on the architecture of a Worklight app and explains how to combine native controllers, such as a tabbar, in Cordova-based apps. Read it thoroughly and implement accordingly:

0
votes
  • For Web, use the Worklight Tab bar control -- as you have already done it.

  • For Native, you have to design a tab in the native code.

As suggested by @Idan, afterwards you have to establish communication/interaction between.

Read more: Combining native and web controls in Cordova based applications

0
votes

If you are using worklight ,you can integrate both native and web codes,but it is bit tricky,and difficult to handle all the controls from native to web pages,and loading different pages onclick of tabs. It is better to implement custom web tab bar look like native tab bar.

You can design custom tab bar in web more similar to native.