Titanium Community Questions & Answer Archive

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

Tableview Header View

Hi,

I'm creating a tableview, however I'd like to have some content before the tableview that will scroll up with the tableview. After digging into the API guide a bit, I discovered I can assign a headerView to a tableview. This is correct isn't it? I can't seem to get it to work however:


var header = Ti.UI.createView({
    width: "100%",
    height: 107,
    backgroundImage: 'path.jpg',
    top: 5
});
win.add(header);

    var deck_preview = Ti.UI.createTableView({  
        style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
        headerView: 'header'
    });

Thanks

— asked October 18th 2010 by Connor Zwick
  • headerview
  • tableview
1 Comment
  • what's the problem, i don't get it :-)?

    And if you only have that code, i allready now can tell you that you need to declare what win is ;)!

    — commented October 18th 2010 by Oluf nielsen

2 Answers

  • Accepted Answer

    headerView: header

    not

    headerView: 'header'

    — answered October 18th 2010 by Dan Tamas
    permalink
    0 Comments
  • var header = Ti.UI.createView({
        width: "100%",
        height: 107,
        backgroundImage: 'path.jpg',
        top: 5
    });
    win.add(header);
    
    var deck_preview = Ti.UI.createTableView({  
      headerView:header,
      style:Titanium.UI.iPhone.TableViewStyle.GROUPED
    });
    

    Looks good :)

    — answered October 19th 2010 by Colton Arabsky
    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.