Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1164] ability to add multiple buttons to navbar

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2012-01-04T11:05:22.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsbuttons, ios, ipad, leftnavbutton, navbar, rightnavbutton
ReporterSindre Sorhus
AssigneeNeeraj Gupta
Created2011-04-15T02:45:36.000+0000
Updated2017-03-22T22:56:21.000+0000

Description

Right now you can only add one button to each of leftNavButton and rightNavButton, this is ok for iPhone, but for iPad there should be possible to add multiple buttons to the navbar.

Comments

  1. Sj101 2011-04-15

    Can't you add a view?

  2. Sindre Sorhus 2011-04-15

    Yes, but then I get just ordinary, non navbar, buttons. I want navbar buttons like those in the Mail app on iPad.

  3. Jeff Haynie 2011-04-15

    Use a button bar

       var bb1 = Titanium.UI.createButtonBar({
           labels:['+', '-'],
           backgroundColor:'#336699',
           style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
       });
       
       win.rightNavButton = bb1;
       
  4. RavenLife 2011-04-15

    I love you guys at appcelerator but this is not invalid

    yes you could use a tabbed bar if you just wanted multiple buttons and didnt care what it looked like. But that is not what Mofie was asking for, nor is it at all a suitable alternative to nav buttons.

    i believe what mofie is asking for (as am i now) is the ability to add multiple 'system' buttons to the NavBar locations. so that we are able to replicate the look and feel of native ipad apps.

    for that matter, what if i wanted 2 tabbed bars in the top right, could i do that? no. so this ticket is valid.

    Ta

    Richie

  5. Kai Pradel 2011-04-15

    Bump - I agree with RavenLife. I've been looking for ways to add more buttons to the navBar and the solution would be to allow a view to be added to either side and allow the button style to be like a native button.

    Please reconsider this and open it back up.

    Kai

  6. Sindre Sorhus 2012-01-02

    RavenLife is correct. This is not invalid. Please reopen.
  7. Stephen Tramer 2012-01-03

    iPhone and iPad both have the restriction that you cannot have multiple buttons in a bar. You must design your own custom view and set it as the left/right navigation button. This bug is invalid.
  8. Sindre Sorhus 2012-01-04

    That is correct, but the problem is that we can't use the system button style (with glow) using Ti.UI.createButton() and adding it to a view. There are ways to do this though, and a lot of apps do it: http://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.html But we rely on what Titanium provides us with. Fortunately in iOS 5 this is [supported natively](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationItem_Class/Reference/UINavigationItem.html): See: leftBarButtonItems and rightBarButtonItems Either reopen this, or ask me to create a new issue.
  9. Stephen Tramer 2012-01-04

    We can't add iOS 5-specific features to the product yet, as that breaks backwards compatibility with iOS 4 devices, which still have a large market share. Taking advantage of iOS 5 features like this would require writing a lot of additional code to work with the appropriate devices. When we begin adding support for setting minimum app versions, it is more likely that iOS 5-specific features will be added.
  10. Stephen Tramer 2012-01-04

    This has been deprecated in favor of TIMOB-6975, which allows adding toolbars (which should also support system styled buttons) to the nav bar.
  11. Stephen Tramer 2012-01-06

    Brief update to this ticket; you may be able to use Ti.UI.Window.toolbar to style appropriately.
  12. Patrick Daigle 2013-07-13

    I know this is an old ticket, but right now I'm looking for a way to achieve this. I tried the suggested workaround (using a toolbar) but it doesn't work unless the toolbar is added to a view and has a fixed width in pixel (Ti.UI.SIZE doesn't work) which is not very convenient. I can provide a complete test case for this if needed, but I think a better solution would be (as Sindre suggested) to use leftBarButtonItems and rightBarButtonItems properties. This would no longer breaks backward compatibility with iOS 4 because the latest release (3.1.1.GA) raised the minimum iOS SDK to 5.0. I think implementing leftBarButtonItems and rightBarButtonItems in Titanium would be nice and also much more elegant than the trick I mentioned above.
  13. Pier Paolo Ramon 2013-12-24

    To [~pdaigle] and everyone looking for the ability to add more than one item in the right nav area, we're pleased to announce this small yet useful module: https://github.com/smclab/TiNavItems Instead of an hack (toolbars and similar) that break horribly in iOS 7 we're using directly the iOS 5+ feature.
  14. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source