Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Use iPhone System button styles in simple view

Is it possible to use the iPhone System Button styles in a regular view, other than let's say a toolbar of some kind?

This works and the button shows up nicely:

var myButton = Titanium.UI.createButton({
    title          : 'Hello World',
    top            : 7,
    left           : 5,
    height         : 25,
    width          : 60,
    backgroundColor: '#000'
});
myView.add(myButton);

While in this case the button doesn't show up at all:

var myButton = Titanium.UI.createButton({
    title          : 'Hello World',
    top            : 7,
    left           : 5,
    height         : 25,
    width          : 60,
    backgroundColor: '#000',
    style          : Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
myView.add(myButton);

Cheers!

— asked March 19th 2010 by Florian Plank
  • button
  • iphone
  • mobile
  • style
  • system
  • view
0 Comments

2 Answers

  • System buttons (and formats) are only allowed in toolbars and navbars (unless someone has any tricks). You can do a custom button. This is a forced design of IOS I believe. Search for systembutton in the API reference to see this confirmed.

    — answered May 18th 2011 by abraham williams
    permalink
    0 Comments
  • Hi there,

    I'm not certain, but if not you could create a graphic of the appropriate button-type.

    I see from the docs there are also 'backgroundDisabledImage' and 'backgroundSelectedImage' to help mimic various states - depending on the button and how it's being used.

    cheers,
    Chris.

    — answered March 19th 2010 by Chris Reed
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.