TabBar problem

0 views
Skip to first unread message

iHello

unread,
Aug 12, 2009, 10:11:58 AM8/12/09
to LiquidGear
I tried to add tabBar but no result :(

<script type="text/javascript">
// lg.navigation.show();
// console.log(‘bind’);
//lg.bind(‘lg_init’, initTabs);

function initTabs() {
//console.log(‘initTabs’);
lg.tabs.add({btn:1, title:‘Home’, icon:‘css/img/1.png’,
callback:‘onTabClick1′});
lg.tabs.add({btn:2, title:‘Files’, icon:‘css/img/2.png’,
callback:‘onTabClick2′});
lg.tabs.add({btn:3, title:‘Favorites’, icon:‘css/img/3.png’,
callback:‘onTabClick3′});
lg.tabs.show();
}
initTabs();

</script>

iHello

unread,
Aug 12, 2009, 10:20:30 AM8/12/09
to LiquidGear
this code in index.html only

Giraldo Rosales

unread,
Aug 12, 2009, 10:35:00 AM8/12/09
to liqui...@googlegroups.com
You may want to keep the initTabs call with the lg_init listener.
Other than that, the icons must be in the Resource directory and added
into your XCode project as "Relative to enclosed project". Then your
tabs would be like,

lg.tabs.add({btn:1, title:‘Home’, icon:‘1.png’,
callback:‘onTabClick1′});

Note that you will not be able to use the relative www paths, but must
be in the project since the actual tabs are in Obj-C and not JS.

-G

iHello

unread,
Aug 12, 2009, 7:29:31 PM8/12/09
to LiquidGear
I must put initTabs(); to shell.js both with realization?
What about settings.plist ?

iHello

unread,
Aug 12, 2009, 8:00:01 PM8/12/09
to LiquidGear
Please describe where I must put this code:

iHello

unread,
Aug 12, 2009, 8:02:56 PM8/12/09
to LiquidGear
sorry:

unction initTabs() {
//console.log(‘initTabs’);
lg.tabs.add({btn:1, title:‘Home’, icon:‘1.png’,
callback:‘onTabClick1′});
lg.tabs.add({btn:2, title:‘Files’, icon:‘2.png’,
callback:‘onTabClick2′});
lg.tabs.add({btn:3, title:‘Favorites’, icon:‘3.png’,

iHello

unread,
Aug 13, 2009, 7:07:17 AM8/13/09
to LiquidGear
I have added 1.png and 2.png to the Resource folder and
this code to the shell.js but no result...

function initTabs() {
function gotoInfo() {
lg.page.open('info'); // I'd like someting like that...
}

function gotoContacts() {
lg.page.open('contacts'); // I'd like someting like that...
}

lg.tabs.add({btn:1, title:‘Home’, icon:‘1.png’,
callback:‘gotoInfo′});
lg.tabs.add({btn:2, title:‘Files’, icon:‘2.png’,
callback:‘gotoContacts′});

lg.tabs.show();
}

initTabs();

Giraldo Rosales

unread,
Aug 13, 2009, 12:02:45 PM8/13/09
to liqui...@googlegroups.com, Juriy Salmin
You will want to have the following code in your script tags within your head (or you can put it in an external script if you are using one):

lg.bind('lg_init', initTabs);

function initTabs() { 
lg.tabs.add({btn:1, title:'Home', icon:'btn1.png', callback:'gotoInfo'}); 
lg.tabs.add({btn:2, title:'Files', icon:'btn2.png', callback:'gotoContacts'}); 
lg.tabs.show(); 
}

function gotoInfo() { 
lg.page.open('info');
function gotoContacts() { 
lg.page.open('contacts');
}

This will work with the images in the Resource folder that come with the project. You can add your own images and rename them above if needed. Just make sure that when you drop them in the Resource folder in the Finder, that you also included in the project relative to the enclosing group.

-G

On Aug 12, 2009, at 9:11 AM, iHello wrote:

Reply all
Reply to author
Forward
0 new messages