NimbleKit - fast iOS app development

Understanding tab bars

Problem discussions

Understanding tab bars

Postby Andy Baird » Wed Jun 03, 2009 5:41 am

I'm having trouble making the tab bar do what I want, probably because I don't understand how it's supposed to be used, and I'm hoping some of the more experienced folks here can help me understand. I don't (yet) own an iPhone or iPod Touch, so all I know about the UI comes from playing with Apple's iPhone Simulator and reading the iPhone Human Interface Guidelines... hence, I may be making some wrong assumptions about how things are supposed to work. :-)

First, let me describe the structure of my app. There are three top-level pages and about 30 secondary pages. The primary pages are:

main--the index, with <A HREF> links to the subsidiary pages
map--a page containing an imagemap, also with links to the subsidiary pages
extras--a single page with no links at present

secondary pages--contain detailed information on index items, and link to each other

Here's what I'd like to have:

A tab bar showing "Index", "Map", and "Extras" buttons. These would always be shown, and would always link to the three top-level pages. No tab would ever link to a secondary page.

Here's the behavior I get (see main-page code below):

Let's say I start at the Index page (the default when the app launches). I use an HTML link on that page to navigate to one of the secondary pages. But the tab bar icon of the index page I just left remains highlighted. That's problem number one, since I'm no longer looking at that page.

Clicking the Index tab does nothing--I remain on the secondary page. That's problem number two. I want that tab to take me back to the index page.

Now suppose I click on the Map tab. I go to that page--no problem there. But if I then click on the imagemap to link to a secondary page, I'm in the same situation: the Map tab's icon remains highlighted even though I'm no longer looking at the Map page, and clicking it does nothing.

And now I'm really stuck, because clicking the Index tab just gets me the secondary page I'd linked to from the Index page, and clicking the Map tab gets me the secondary page I'd linked to from the Map page. In short, I can no longer access the Index or Map pages from their tabs.

It's possible that my confusion arises from trying to get a behavior that tabs were not intended to provide. That is, maybe a tab is always supposed to correspond to the current page, so the inter-page linking I'm doing--and in particular, linking to secondary pages that have no associated tabs--is simply not something one should do with tabs.

The basic issue remains: I want to have three navigational elements--top or bottom of page, I'm not fussy--that always take me to the three primary pages, no matter what secondary page I may be viewing at the moment. If tabs aren't the way to do this, I'd welcome suggestions. :-) I like the way the tabs look, but I'm not married to them.

Andy Baird

Code (on main.htm page only):

<script type="text/javascript">
var tabController = new NKTabBarController();
tabController.setTabBarForPage("main.html","Index","index-icon2.png");
tabController.setTabBarForPage("map.html","Map","map-icon.png");
tabController.setTabBarForPage("extras.html","Extras","extras-icon.png");
</script>
Attachments
Tab-bar.jpg
Tab-bar.jpg (9.88 KiB) Viewed 1936 times
User avatar
Andy Baird
 
Posts: 113
Joined: Sat May 30, 2009 10:32 pm
Location: On the road in the southwestern US

Re: Understanding tab bars

Postby sunny » Wed Jun 03, 2009 9:50 am

The situation you described is actually feature and supposed to work like this, there are many apps which use this kind of architecture and specially for this we can use global tab bar controller and 3 local navigation controllers, this would make your app easy to use as this type of user interface is common to user.

Here is an example:
var tabController = new NKTabBarController();
tabController.setTabBarForPage("main.html", "NKit", "phone.png");
tabController.setTabBarForPage("VDJRadio.html", "Radio", "headphone.png");

var navController = new NKNavigationController();
navController.setTitle("NKit");
navController.setStyle("Black");
navController.addNavigationItem("About", "about");

NKTabBarController has to be always created first and once, but NKNavigationController should be created separately on every page and can have different title and different right button item.
NKNavigationController automatically saves paths like main.html->secondary.html->etc.html and created "Back" button to be able to come back
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Understanding tab bars

Postby Andy Baird » Sun Jun 14, 2009 1:13 am

If I understand what you're proposing, I don't think it solves my problem, which is to create a navigational element that is the same on every page and that links to my three main pages even if the current page is not one of those three.

It seems that a tab bar cannot be used for this purpose, because (tell me if I'm wrong) it must always have a highlighted tab for the current page. In my app, the current page may be one of several dozen lower-level pages that (obviously) don't need their own tabs. As I understand it, I can have a global tab bar with tabs A, B, and C... but if the current page is Q, that's not permissible, because there must always be a tab for the current page. Is that correct?

An alternative approach would be to use several navigation controller buttons. Apple's HIG permits this, and I've seen apps that do it--see attached "FTP On The Go" screenshot--but NimbleKit's current (v1.2) implementation is only able to place one rectangular button at the right of a navigation bar, plus a back button that I don't need or want.

As you can see in the screenshot, "FTP On The Go" has two navigation bars with two buttons apiece. What I'd like is one navigation bar with three (or possibly four) buttons. Is this possible, perhaps in a future release of NimbleKit?

Andy Baird
Attachments
FTP On The Go screenshot.jpg
FTP On The Go screenshot.jpg (40.03 KiB) Viewed 1831 times
User avatar
Andy Baird
 
Posts: 113
Joined: Sat May 30, 2009 10:32 pm
Location: On the road in the southwestern US

Re: Understanding tab bars

Postby sunny » Sun Jun 14, 2009 9:06 am

yes, sure, I wanted to implement such bar before, but forgot, now I added it to the list of upcoming features
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Understanding tab bars

Postby Andy Baird » Sun Jun 14, 2009 3:20 pm

Thank you! :-) I hope we will be able to specify whether the nav bar goes at the top or bottom of the screen.

Andy Baird
User avatar
Andy Baird
 
Posts: 113
Joined: Sat May 30, 2009 10:32 pm
Location: On the road in the southwestern US

Re: Understanding tab/tool bars

Postby Andy Baird » Sun Jun 14, 2009 10:08 pm

I've been playing around with Interface Builder, and it appears you cannot put more than two buttons in a navigation bar, so that won't help me--I need at least three. However, a Toolbar can have as many buttons as will fit, and they can be text-only or icon buttons. I mocked up what I need in IB:

Toolbar1.jpg
Toolbar1.jpg (8.72 KiB) Viewed 1796 times

However, I can't find any reference to toolbars in the NimbleKit documentation. So now my question is: when will NimbleKit be able to do this? :-)

I hate to keep asking for feature additions, but I'm trying to solve a basic user interface problem... I know what I want; I just haven't found a way to do it with NimbleKit as yet. Thanks for all your hard work on this product!

Andy Baird
User avatar
Andy Baird
 
Posts: 113
Joined: Sat May 30, 2009 10:32 pm
Location: On the road in the southwestern US

Re: Understanding tab bars

Postby sunny » Sun Jun 14, 2009 10:27 pm

There are no references to anything in Interface Builder, everything is created programmatically.
Toolbar will be added in version 1.4 and also we plan to add feature to mix objective-c and javascript, then it will be possible to get references to obj-c objects and manipulate them too.
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Understanding tab bars

Postby ryubr » Fri Jun 19, 2009 5:41 am

Hi,

Nice material to read, it was a great help for me. However I got a problem, i have transparent png's with the icons for the tab bars, but when they load it shows only the "shape" of the image, but not it as i see on the post above... How the png image should be formated (size, colors and transparency index)?

Thanks :-)
ryubr
NimbleKit Expert
 
Posts: 445
Joined: Fri Jun 19, 2009 5:36 am

Re: Understanding tab bars

Postby cutmaster » Sat Jun 20, 2009 10:03 am

Icons on tab bar are only using transparency to show different levels of gray (or blue if the button is selected). Every color is converted to white/blue if its transparency is setted to 100% opaque on your png.
You can't show it in a color mode (Cocoa limitation in a "normal" usage of the navigation bar). Of course it is possible to bypass it programmaticaly but... in objective-C ;-)
cutmaster
 
Posts: 104
Joined: Fri Jun 19, 2009 11:49 am

Re: Understanding tab bars

Postby Andy Baird » Sat Jun 20, 2009 8:17 pm

See page 113 of Apple's "iPhone Human Interface Guidelines":

----------------------
After you’ve decided on the appearance of your icon, follow these guidelines as you create it:

* Use the PNG format.
* Use white with appropriate alpha and no shadow.
* Use anti-aliasing.
* For toolbar and navigation bar icons, create an icon that measures about 20 x 20 pixels.
For tab bar icons, create an icon that measures about 30 x 30 pixels.

Note: The icon you provide for toolbars, navigation bars, and tab bars is used as a mask to create the icon you see in your application. It is not necessary to create a full-color icon.

iPhone OS automatically provides the pressed or selected appearance for items in navigation bars, toolbars, and tab bars, so you only need to provide a single version of an icon. Because these visual effects are automatic, you cannot change their appearance.
----------------------

Andy Baird
User avatar
Andy Baird
 
Posts: 113
Joined: Sat May 30, 2009 10:32 pm
Location: On the road in the southwestern US

Next

Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 0 guests