Titanium JIRA Archive
Alloy (ALOY)

[ALOY-984] Support RightNavButtons and LeftNavButtons in Alloy XML Markup

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-06-02T17:46:52.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.5.0
ComponentsXML
Labelsqe-manualtest
ReporterBenjamin Hatfield
AssigneeTim Poulsen
Created2014-04-09T23:58:12.000+0000
Updated2016-01-25T17:43:02.000+0000

Description

ENVIRONMENT: Alloy from master (commit 2267d1d002d7f7bd1f9b61557c11c8d24f259a45/Tue Mar 25 17:31:19 2014 -0400) Titanium SDK 3.3.0.v20140409153121 Appcelerator Studio, build: 3.3.0.201403281814 Mac OS X 10.8.5 Xcode 5.0.2/iOS 7.0.3/iPad or iPhone Retina simulator DESCRIPTION: Ti SDK 3.3.0 is introducing two new iOS-only properties for a Window object: rightNavButtons and leftNavButtons. These accept an array of views. Just an FYI to see if it would be possible to implement these properties in Alloy XML. See sample below. YAML Docs: https://github.com/appcelerator/titanium_mobile/blob/master/apidoc/Titanium/UI/Window.yml#L409-L413 https://github.com/appcelerator/titanium_mobile/blob/master/apidoc/Titanium/UI/Window.yml#L634-L638 SAMPLE XML:
<Alloy>
    <NavigationWindow>
        <Window>
            <LeftNavButtons>
                <View width="25" height="25" backgroundColor="red"/>
                <View width="25" height="25" backgroundColor="green"/>
                <View width="25" height="25" backgroundColor="blue"/>
            </LeftNavButtons>
            <RightNavButtons>
                <Button title="btn 1"/>
                <Button title="btn 2"/>
                <Button title="btn 3"/>
            </RightNavButtons>
        </Window>
    </NavigationWindow>
</Alloy>
TITANIUM EXAMPLE:
var win = Ti.UI.createWindow();
win.leftNavButtons = [
    Ti.UI.createView({backgroundColor: 'red', height: 25, width: 25}),
    Ti.UI.createView({backgroundColor: 'green', height: 25, width: 25}),
    Ti.UI.createView({backgroundColor: 'blue', height: 25, width: 25}),
];
win.rightNavButtons = [
    Ti.UI.createButton({title: 'btn 1'}),
    Ti.UI.createButton({title: 'btn 2'}),
    Ti.UI.createButton({title: 'btn 3'})
];

var navWin = Ti.UI.iOS.createNavigationWindow({window:win});
navWin.open();

Attachments

FileDateSize
NavButtons.png2014-04-09T23:58:12.000+000017289

Comments

  1. Tim Poulsen 2014-06-02

    PR: https://github.com/appcelerator/alloy/pull/423 Test app: Use the app included in the pull request or the sample XML from above.
  2. Tim Poulsen 2014-06-02

    PR merged
  3. Federico Casali 2014-08-13

    Verified working as expected. NavButtons array are correctly visualized. TestCase added to TCMS. TiSDK 3.4.0.v20140813022514 Appcelerator Studio 3.3.1.201408121314 CLI 3.4.0-dev Alloy 1.5.0-dev iPhone iOS 7.1.2 Xcode6-beta5 Closing.
  4. Henry David Spells III 2016-01-25

    Would you mind adding the above Alloy example to the rightNavButtons section of the http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window docs page? Also a quick sentence saying that hide and show doesn't currently work but saving off the buttons then setting them to null and restoring them will allow you to hide and show the buttons (bonus). Not having to do a bunch of research just to interpret the docs would be really helpful.

JSON Source