How to Use - TabbedBar?
Alright I am having troubles using TabbedBar on my App… Here is pretty much what I have, and what I want:
WHAT I HAVE
A TableView. In the first row is an image and some buttons. In the second row, I have a TabbedBar with 3 options and then in the 3rd row I have some text.
WHAT I WANT
- A TableView; Row 1 is the image and some buttons (Unrelated to this question)
- At the top of Row 2, a TabbedBar with 3 options (Related, Comments, Info)
- Default is: Related
- When you click on one of the options, the content below the TabbardBar changes to whatever I want.
Anybody help? My code is all over the place right now, so I can't really show you anything, and the KitchenSink example isn't really what I want, at all…
4 Answers
-
Try adding a textarea or label below the tabbed bar and change its content based on the button clicked. There may be a more efficient way of handling tabbedBar indexes but this always works for me.
Hope it helps
yourTabbedBarName.addEventListener('click', function(e){ if(e.index == 0) // Related { content.text = 'Related content; // if using a textarea it should be content.value }); if(e.index == 1) // Comments { content.text = 'Comments content'; }); if(e.index == 2) // Info { content.text = 'Info content'; }); }); var content = Ti.UI.createLabel();
-
In response to James K:
For the TabbedBar, all I need is this:
- Related Videos - Will list 5-10 rows of various videos that have something to do with the main page
- Comments - Will list 7 rows of various comments about the main page
- Information - Will list 5 hand-written things about the main paged
All information is stored in a MySQL Database that was grabbed in another window and will be displayed.
-
Kelly Redd, I have how I want to show the information all fine. What I need is to be able to change it when someone chooses one or the other of the tabs. Right now it's not working, or if it is it's really laggy and choppy.
-
Bump