Titanium Community Questions & Answer Archive

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

Can I create a standard "back" style button (a button that points left) in the navigation bar on a web view?

I need to create a back button for several pages that are really just web views. I've managed to create a working back button, but, even after a lot of time digging, can't see how to make the button the standard "back" style button.

Everyone I show the app to says "You need the back button to be the back style button".

I have to assume this is possible, but I just can't find it.

My code is pretty much exactly like the code in this tread, only it functions as a browser back button:
http://developer.appcelerator.com/question/1121/back-button-in-title-bar

// Back Button
var backBtn = Titanium.UI.createButton({
   title:'Back',
   style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});

backBtn.addEventListener( 'click', function() {
    webview.goBack();
});

Ti.UI.currentWindow.setLeftNavButton(backBtn);

Thanks for ANY help, as I've spent way too much time just trying to style this button. :)

Peter

— asked July 3rd 2010 by Peter janett
  • back
  • button
  • style
  • view
  • web
  • webview
0 Comments

5 Answers

  • Accepted Answer

    http://www.keanhui.com/archives/755

    Download the psd, extract the back style button, create a button and set the backgroundImage as the arrow.

    — answered July 8th 2010 by Sj Singh
    permalink
    3 Comments
    • Is it true that Titanium itself does not support a button in the title bar of a WebView? This solution is iphone specific. Is there an Android option?

      — commented October 2nd 2011 by Andy Weber
    • Is it even legal to use the "keanhui" assets in an app anyway..?

      — commented November 17th 2011 by Derek Tatum
    • It will be legal as long as you don't admit it lol. That shape / design is so inconspicuous now I don't think it would matter much

      — commented May 11th 2012 by Buck Kimbriel
  • I am having to assume that the very basic concept of a back style button in a web view is not possible in Titanium. Hard to believe, but if it's true, I may need to abandon Titanium all together…

    Still hoping I'm wrong, I hope someone can help.

    Thanks in advance,

    Peter

    — answered July 8th 2010 by Peter janett
    permalink
    0 Comments
  • I'm looking for the same thing, except mine is in a normal tab group navigation bar. I can't believe there aren't styles built in for forward and back arrow buttons.

    — answered July 13th 2010 by Chris Kelly
    permalink
    0 Comments
  • Pretty sad that you are consider abandoning Titanium over this issue… if you want to develop web app, then do so, but if you want to develop real apps, using real OS controls and features, then why on earth are you using Titanium as a wrapper for a web app? The point of Titanium is not so that HTML developers can make iPhone apps with HTML, but so that web developers as a whole can create REAL apps on the platform using REAL platform controls and features. Looks like you only want a wrapper for webview. Perhaps a lack of programming knowledge on your part rather than a lack of features on Titanium's part.

    — answered August 6th 2010 by Jonathan Bardi
    permalink
    0 Comments
  • Hmm seems to work with out doing some special code,
    my code looks like this and works good.

    
    var win1 = Titanium.UI.createWindow({  
        title:'Router Commands',
        backgroundColor:'#fff',
        url:'windows/win1.js'
    });
    
    //WIN1.js --->
    
    //Creqte DAta
    var data = [
        {title:'a', hasChild:true, test:'/ios/a.js'},
        {title:'b', hasChild:true, test:'../ios/b.js'},
        {title:'c', hasChild:true, test:'../ios/c.js'}
        ];
    
        // create table view
    var tableview = Titanium.UI.createTableView({
        data:data
    });
    
    // create table view event listener
    tableview.addEventListener('click', function(e)
    {
        if (e.rowData.test)
        {
            var win = Titanium.UI.createWindow({
                url:e.rowData.test,
                title:e.rowData.title
            });
            Titanium.UI.currentTab.open(win,{animated:true});
        }
    });
    
    // add table view to the window
    Titanium.UI.currentWindow.add(tableview);
    
    — answered August 31st 2011 by karl andreasson
    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.