Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Buckeyes1995

macrumors member
Original poster
Mar 4, 2011
95
11
This is probably a stupid question.. and maybe I'm not looking at this the right way.. but here goes.

The app that I'm working on is structured as follows (not to scale obviously):

--------------------------------------
| Title Label |
--------------------------------------
| |
| |
| Work Space View |
| |
| |
| |
---------------------------------------
| |
| Tool Kit View |
| |
| |
---------------------------------------
| |
| Tab Bar (3 buttons) |
---------------------------------------


The Label and Tool Kit views are all static. I used a Tab Bar element (NOT a Tab Bar Controller) from IB. All I want to do is change the Work Space View to another view to another view when the various buttons on the Tab Bar are pressed. Seems easy.. but I cannot figure out in IB how to hook up the IB Actions.. it appears the elements on the Tab Bar (buttons) can't be hooked up to IB Actions? Do I have to do this all programatically?

Do I NEED to use a Tab Bar Controller? If so, what's the purpose of the Tab Bar Element? I've searched all around and can't find any examples or documentation on using a Tab Bar in IB, other than in relation to a TB Controller.

Thanks, and sorry if this is obvious or dumb in advance :D
 
Seems to me a UIToolBar rather than a UITabBar would satisfy your needs.

I had considered that.. I just like the Tab Bar look better.

Just for my knowledge, what is the purpose of the IB Tab Bar element.. it would seem I could connect IBAction outlets to it to 'do things', but I can't figure out how.

I'm not opposed to a Tab Bar Controller.. just more curious now than anything else.

Thanks.
 
Just for my knowledge, what is the purpose of the IB Tab Bar element.

From the Quick Help for UITabBar:
The UITabBar class implements a control for selecting one of two or more buttons, called items. The most common use of a tab bar is to implement a modal interface where tapping an item changes the selection. Use a UIToolbar object if you want to momentarily highlight or not change the appearance of an item when tapped. The UITabBar class provides the ability for the user to customize the tab bar by reordering, removing, and adding items to the bar. You can use a tab bar delegate to augment this behavior.

it would seem I could connect IBAction outlets to it to 'do things', but I can't figure out how.
That's not normally how tab bars are used. Rather, you assign it a delegate and then use the delegate method(s) to respond to events.
 
From the Quick Help for UITabBar:



That's not normally how tab bars are used. Rather, you assign it a delegate and then use the delegate method(s) to respond to events.

I completely missed the delegate reference in the documentation. That clears it up.

Thanks :D
 
Thanks for mentioning the delegate use for the Tab Bar.

I have it working perfectly now... but I'm still puzzled by what the 'Tab Bar' is really for (yes, I'm probably way overthinking this.. but I hate to blindly use something and not understand it).

Everything I could find says that the Tab Bar Controller is the way you're "supposed " to implement tab bar applications. If so, why is the Tab Bar element included in IB? And when would you use it.

I'll probably go back and use a Tab Bar Controller instead of a Tab Bar w/ delegation, but at least I learned how to use it :D
 
...but I'm still puzzled by what the 'Tab Bar' is really for (yes, I'm probably way overthinking this.. but I hate to blindly use something and not understand it).

Everything I could find says that the Tab Bar Controller is the way you're "supposed " to implement tab bar applications. If so, why is the Tab Bar element included in IB? And when would you use it.
I'm not sure it's a cut-and-dry as you might like (as with much programming) but my understanding is that you use a UITabBarController when you want to set up custom view controllers for each tab (hence its viewControllers property). You would use UITabBar when you want the look and functionality of tab bar but don't have the above situation, say, only a single view controller. UITabBarControllers provide other advantages, such as the "More view controller" that you don't get with a simple UITabBar. Hope that helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.