Tool bar icons missing

179 views
Skip to first unread message

Twitch

unread,
May 8, 2009, 3:49:37 PM5/8/09
to phonegap
I'm probably missing something simple, but since my 4 and 2 year olds
come in every 5 minutes and order me around it's hard to concentrate.
Using the PhoneGap demo files, I was able to get the tool bar title
and the black bar at the bottom, but the bar has no buttons. I didn't
see any images in the phonegap project for these so I'm assuming it
uses default images built into the phone.

Anyone know which piece of code I'm missing that the icons wouldn't
show. I linked to the phonegap.js file and put this in my index.html
file.

function setupToolbars() {
uicontrols.createTabBar();

var toprated = 0;
uicontrols.createTabBarItem("toprated", "Top Rated",
"tabButton:TopRated", {
onSelect: function() {
navigator.notification.alert("Top Rated selected");
uicontrols.updateTabBarItem("toprated", { badge: +
+toprated });
}
});

var recents = 0;
uicontrols.createTabBarItem("recents", "Recents",
"tabButton:Recents", {
onSelect: function() {
navigator.notification.alert("Recents selected");
uicontrols.updateTabBarItem("recents", { badge: +
+recents });
}
});

var history = 0;
uicontrols.createTabBarItem("history", "History",
"tabButton:History", {
onSelect: function() {
navigator.notification.alert("History selected");
uicontrols.updateTabBarItem("history", { badge: +
+history });
}
});

var more = false;
uicontrols.createTabBarItem("more", "More", "tabButton:More", {
onSelect: function() {
if (more) {
uicontrols.showTabBarItems("search", "downloads",
"more");
} else {
uicontrols.showTabBarItems("toprated", "recents",
"history", "more");
}
uicontrols.selectTabBarItem(null);
more = !more;
}
});

try {
uicontrols.createTabBarItem("search", "Search",
"tabButton:Search");
uicontrols.createTabBarItem("downloads", "Downloads",
"tabButton:Downloads");
} catch(e) { debug.log(e) }

uicontrols.showTabBar();
uicontrols.showTabBarItems("toprated", "recents", "history",
"more");

uicontrols.setToolBarTitle("Texans Ticker");
}

function preventBehavior(e) {
e.preventDefault();
};

PhoneGap.addConstructor(function(){
document.addEventListener("touchmove", preventBehavior, false);
setupToolbars();
deviceInfo();
});

Thanks in advance,
Twitch

Michael Nachbaur

unread,
May 8, 2009, 4:40:43 PM5/8/09
to phonegap
Do you have acceleration enabled? I've discovered a bug that causes
random Gap commands to be missed because the acceleration code is
calling javascript on the UIWebView too fast. I'm not sure how fast
they're running, but it's fast enough that it causes problems.

So try disabling acceleration and see if that works for you.

Twitch

unread,
May 8, 2009, 5:04:08 PM5/8/09
to phonegap
Thanks for the reply. I'll check it out later tonight. I'm off to a
gig right now. Gotta pay the bills cause I'm pretty sure my free
iPhone app won't...ha ha Another good reason to go to the gig is
because ever since finding PhoneGap, I haven't been out much. It made
developing for the iPhone fun. Thanks all who contribute!

-Twitch

Twitch

unread,
May 9, 2009, 11:14:48 AM5/9/09
to phonegap
Where do I go to do that. I'm looking through the various files but
not seeing it. I saw your post about the custom icons. Can't wait to
check that out. Thanks for that.

-Twitch

davidroe

unread,
May 10, 2009, 4:27:31 PM5/10/09
to phonegap
the settings are found in PhoneGap.plist

I have also come across this bug, and having disabled both accel and
location, I am still seeing a random amount of tab bar buttons appear.

/dave

Twitch

unread,
May 10, 2009, 4:41:11 PM5/10/09
to phonegap
Thanks for the reply, Dave. I was making it hard on myself looking
through all the files and code...ha ha

-Twitch

Twitch

unread,
May 10, 2009, 5:06:26 PM5/10/09
to phonegap
Looks like you're right, Dave. I disabled acceleration and voilá the
toolbar worked perfectly. Enabled acceleration, the toolbar was
missing the icons again, disabled again and the icons were still
missing. Top part shows up fine.

-Twitch

PanMan

unread,
May 11, 2009, 10:51:37 AM5/11/09
to phonegap
I tried this yesterday, but the history icon is still missing for
me...

Michael Nachbaur

unread,
May 11, 2009, 12:59:41 PM5/11/09
to phonegap
Check out the demo's index.html file. I changed it to showcase
including custom icons, and null (or empty) icons. :-) So that's
expectd, and desired, behaviour.

PanMan

unread,
May 12, 2009, 6:16:14 PM5/12/09
to phonegap
I did check it, but which button should have the custom icon?
I just downloaded your github branch to check, but here are the
following icons:
* Recents has none
* History has a blank one
* more has 3 dots
* Search has a loupe (what's the word for it...)...
* Downloads has a down arrow.

The last 3 are 'official' apple supplied icons.
History links to icon.png, but I don't see any of it.
Am I missing something?
PanMan.

Michael Nachbaur

unread,
May 13, 2009, 12:39:25 AM5/13/09
to phonegap
icon.png isn't a valid toolbar icon, but I didn't have anything else
to check in that wouldn't introduce any additional licensing. But go
to http://glyphish.com/ for instance, they have some great icons
there.

Basically, in the index.html, the one that has "null" for an icon is
supposed to be empty, and the one that says "icon.png" will show up
incorrectly until a better icon gets put in there. But, I've tested
it with the icons from the link up above, and it worked great on my
machine.

davidroe

unread,
May 13, 2009, 3:59:00 AM5/13/09
to phonegap
I think the problem is two-fold: in phonegap.js, queue.ready seems to
have the right values set but it is never checked before dispatching a
command to PhoneGap. and secondly, the AppDelegate sets exec.ready to
true, not queue.ready.

sorry but I'm not up to speed with git yet. anyone care to paste in
their top 5 commands and what they do?

/dave

On May 12, 9:39 pm, Michael Nachbaur <mike.nachb...@gmail.com> wrote:
> icon.png isn't a valid toolbar icon, but I didn't have anything else
> to check in that wouldn't introduce any additional licensing.  But go
> tohttp://glyphish.com/for instance, they have some great icons

PanMan

unread,
May 13, 2009, 4:10:14 AM5/13/09
to phonegap
Ah, great!
I just added one of the glypish icons (to the www dir), and now it
works!
Great work Mike, and when I have some time, I'll draw you a public
domain ugly demo icon.
PanMan.

On May 13, 6:39 am, Michael Nachbaur <mike.nachb...@gmail.com> wrote:
> icon.png isn't a valid toolbar icon, but I didn't have anything else
> to check in that wouldn't introduce any additional licensing.  But go
> tohttp://glyphish.com/for instance, they have some great icons

ryc0de

unread,
May 14, 2009, 7:12:31 PM5/14/09
to phonegap
has any else noticed that using a pre-defined toolbar icon (i.e.
tabButton:Contacts) automatically creates label text that overrides
the one you specify?

uicontrols.createTabBarItem("account", "Account",
'tabButton:Contacts');

creates a contact icon with label 'Contacts' instead of 'Account'

is that how it's supposed to work?

Michael Nachbaur

unread,
May 14, 2009, 7:30:02 PM5/14/09
to phonegap
Yes, that's how it's supposed to work. The systemIcon API of the Apple
SDK specifies that the text and icon are part-and-parcel.

See:
http://developer.apple.com/iphone/library/documentation/uikit/reference/UITabBarItem_Class/Reference/Reference.html#//apple_ref/c/tdef/UITabBarSystemItem

Michael Nachbaur

unread,
May 14, 2009, 7:31:08 PM5/14/09
to phonegap
Thanks, as I mentioned on my reply to your comment you left on my
blog, the following patch should do the trick, though I haven't tested
it yet. http://pastebin.com/f1fc64c7e I'm going to push this up to
master when I get the chance.

On May 13, 12:59 am, davidroe <roe.da...@gmail.com> wrote:
> I think the problem is two-fold: in phonegap.js, queue.ready seems to
> have the right values set but it is never checked before dispatching a
> command to PhoneGap. and secondly, the AppDelegate sets exec.ready to
> true, not queue.ready.
>
> sorry but I'm not up to speed with git yet. anyone care to paste in
> their top 5 commands and what they do?
>
> /dave
>
> On May 12, 9:39 pm, Michael Nachbaur <mike.nachb...@gmail.com> wrote:
>
> > icon.png isn't a valid toolbar icon, but I didn't have anything else
> > to check in that wouldn't introduce any additional licensing.  But go
> > tohttp://glyphish.com/forinstance, they have some great icons

Brock Whitten

unread,
May 14, 2009, 7:35:10 PM5/14/09
to phon...@googlegroups.com
This is sweet guys. Im going to play with this tonight. If its ready for prime time and the public API is good Ill make a tag.

-brock

Michael Nachbaur

unread,
May 14, 2009, 9:32:09 PM5/14/09
to phonegap
Okay, I pushed this up to GitHub. Check it out, and hopefully this
fixes some bugs.

Keep in mind, I'm almost ready to push my updated NavBar code, which
is *way* better than the toolbar support the UIControls stuff has
right now.

On May 14, 4:31 pm, Michael Nachbaur <mike.nachb...@gmail.com> wrote:
> Thanks, as I mentioned on my reply to your comment you left on my
> blog, the following patch should do the trick, though I haven't tested
> it yet.http://pastebin.com/f1fc64c7e I'm going to push this up to
Reply all
Reply to author
Forward
0 new messages