Titanium Community Questions & Answer Archive

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

Create a button inside a webview

Hello,

I am finally getting around to making my Titanium 0.8 app work with iOS4+ however this means redoing it in the new version of Titanium.

My app uses webviews exclusively and all the JS is executed onload.

However it seems that none of this works. I can't even get the webview to create a simple button. Is this no longer possible?

Take this for example

<body>
    <img src="images/gfb.gif" height="79" width="235" />
    <div id="picker"></div>
    <div style="margin-top:25px;"></div>
    <div id="button1" style="height:60px"></div>
    <script>
    Titanium.API.info('Before button');
    //Create a button for serching
    var button1 = Titanium.UI.createButton({
        id:'button1',
        backgroundImage:'images/BUTT_red_off.png',
        backgroundSelectedImage:'images/BUTT_red_on.png',
        backgroundFocusedImage:'images/BUTT_red_on.png',
        title:'Search nearby',
        color:'#ffffff',
        height:57,
        fontSize:20,
        fontWeight:'bold'
    });
    Titanium.API.info('After button');
    </script>
</body>
</html>

This just doesn't work for me.

I am happy to recode this in a better way but as I was schooled in the old <0.8 way I could do with a bit more examples in how to do the above layout?

Basically its a logo, full iphone width, a picker then a large red button. (Picker code is removed from the example, just to keep things clean)

Thanks
John

— asked October 2nd 2010 by John Wards
  • iphone
  • mobile
  • webview
0 Comments

2 Answers

  • Bump?

    — answered October 4th 2010 by John Wards
    permalink
    0 Comments
  • I use CSS3 buttons for my webviews. So you can have pretty and perso styles…

    — answered October 4th 2010 by Ivan Mathy
    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.