无法在SplitWindow Windows中看到Title / TitleControl

时间:2013-06-23 20:55:02

标签: titanium appcelerator titanium-mobile appcelerator-mobile

  • 申请类型:移动
  • Titanium SDK :3.1.1.GA
  • 平台&版本:iOS 6.1
  • 设备:iOS模拟器
  • 主机操作系统:OSX 10.8.4
  • Titanium Studio :3.1.1.201306112235

我的Alloy应用程序中有一个SplitWindow控件,我似乎无法显示主窗口和详细信息窗口的Title或TitleControl。我在JIRA中发现Alloy还不支持SplitWindow Windows的TitleControl,但即使在JS中创建它们似乎也不起作用。我在下面提供了我的代码。这是一个如何渲染SplitWindow的截图。

的settings.xml

<Alloy>
    <SplitWindow id="settings" navBarHidden="false">
        <Window id="master_window" navBarHidden="false">
        </Window>

        <Window id="detail_window" navBarHidden="false">
        </Window>
    </SplitWindow>
</Alloy>

settings.js

function bind() {

    $.master_window.setNavBarHidden(false);
    $.master_window.setTitle('Title here'); 

};

bind();

1 个答案:

答案 0 :(得分:0)

<Alloy>
    <SplitWindow id="index" formFactor="tablet">
        <Window>
            <NavigationGroup id="masterView">
                <Window id="master_window" navBarHidden="false"  title="Master"></Window>
            </NavigationGroup>
        </Window>
        <Window>
            <NavigationGroup id="detailView">
                <Window id="detail_window" navBarHidden="false" title="Detail">
                    <ListView id="list" defaultItemTemplate="template1"></ListView>
                </Window>
            </NavigationGroup>
        </Window>
    </SplitWindow>
</Alloy>

显示您需要的标题是NavigationGroup或TabGroup

enter image description here

这是一个类似的示例,但是使用TabGroup来显示标题而不是NavigationGroup

<Alloy>
    <SplitWindow id="index" formFactor="tablet">
        <!-- use TabGroup to get title to show -->
        <TabGroup>
            <Tab title="tab 1" >
                <!-- hide the tabBar so it looks like a regular window -->
                <Window id="master_window" tabBarHidden="true"  title="Master"></Window>
            </Tab>
        </TabGroup>
        <Window>
            <!-- use NavigationGroup to get title to show -->
            <NavigationGroup id="detailView">
                <Window id="detail_window" navBarHidden="false" title="Detail">
                    <ListView id="list" defaultItemTemplate="template1"></ListView>
                </Window>
            </NavigationGroup>
        </Window>
    </SplitWindow>
</Alloy>