Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Titanium Mobile 用のうすーーーい TabGroup Wrapper
class AppTabGroup
constructor: (glb = globals) ->
@tabGroup = Ti.UI.createTabGroup()
@tabGroup.addEventListener "focus", (e) ->
glb.currentTab =
getTabGroup: () ->
return @tabGroup
appendTab: (param) ->
tab = Ti.UI.createTab param
@tabGroup[param.tabId] = tab if param.tabId? and typeof param.tabId is "string"
@tabGroup.addTab if param.tabId then @tabGroup[param.tabId] else tab
open: (defaultTab = 0) ->
@tabGroup.setActiveTab defaultTab
# Modularization
module.exports = AppTabGroup

This comment has been minimized.

Copy link
Owner Author

ryugoo commented Jun 27, 2012

How to use (CoffeeScript)

AppTabGroup = require "AppTabGroup"
tabGroup = new AppTabGroup()
    tabId: "tab0" # [String] Tab ID parameter
    title: "Tab"
    window: Ti.UI.createWindow
        title: "Window"
        backgroundColor: "#FFFFFF" # [Number] Default tab index (0 start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.