IUISectionList change size?

Discussion in 'Jiggy Runtime Development' started by rob spriggs, Jun 17, 2008.

  1. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    hi, another problem for you.


    i have borrowed this code from the geekygoodness site,
    it is now working almost perfectly in my own app however when it runs it takes up the whole screen. can any one tell me how to shrink it so that i have enough room for my top and bottom navigation bars?

    am i right in thinking that it has somthing to do with this bit of code;

    *var appTable = new IUISectionList( mainView.bounds , mainView );*

    and if so what does mainView.bounds mean?


    thanks in advance for all the help recieved so far



    heres the code



    include( 'iuikit.js' );

    var window = new IUIWindow();
    var mainView = new UIView( window.bounds );

    window.setContentView( mainView );

    var appTable = new IUISectionList( mainView.bounds , mainView );

    var appList = dir_list( '/Applications/' );

    var sectionKeys = {
    A: 0, B: 1, C: 2, D: 3, E: 4, F: 5, G: 6,
    H: 7, I: 8, J: 9, K: 10, L: 11, M: 12, N: 13,
    O: 14, P: 15, Q: 16, R: 17, S: 18, T: 19,
    U: 20, V: 21, W: 22, X: 23, Y: 24, Z: 25, 123: 26,
    a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6,
    h: 7, i: 8, j: 9, k: 10, l: 11, m: 12, n: 13,
    o: 14, p: 15, q: 16, r: 17, s: 18, t: 19,
    u: 20, v: 21, w: 22, x: 23, y: 24, z: 25
    };

    var sections = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','123'];

    for( var i = 0; i < sections.length; i++ ) {

    appTable.addSection({
    title: sections[ i ]
    });

    }

    for( var i = 0; i < appList.length; i++ ) {
    var myLetter = appList[ i ].substr( 0 , 1 );
    var mySection = eval( 'sectionKeys.' + myLetter );

    appTable.addRow({
    title: appList[ i ].replace( /.app/g , '' ),
    section: mySection
    });

    }
  2. blackjak231

    blackjak231 Member

    Joined:
    Oct 1, 2007
    Messages:
    759
    Likes Received:
    6
    Device:
    iPhone 4 (White)
    You got that right, its in this peice of code:
    Code:
    var appTable = new IUISectionList( mainView.bounds , mainView );
    Before i give you the code to change the size, i'll explain what mainView bounds is for. Basically it means that your table will be in your mainView bounds, it wont be bigger or smaller.

    So here is what you should do to change its size:
    Code:
    var appTable = new IUISectionList( [ 0 , 0 , 320 , 480] );
    The first "0" is to set how far from the left side it will be.
    The second "0" is to set how far from the top it will be.
    The "320" is to set its width(default)
    The "480" is to set its height.

    The second mainView needs to be there because it replaces mainView.addsubview(). Im not sure of this, but pretty sure! So your code should look like this:
    Code:
    var appTable = new IUISectionList( [ 0 , 0 , 320 , 480] , mainView );
    I hope it works, else, i dont really know....
    Cya!

    EDIT:I think i know what the second mainView is for, i explain it above!
  3. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    thanks so much for your help ill give it ago now

    cheers
  4. blackjak231

    blackjak231 Member

    Joined:
    Oct 1, 2007
    Messages:
    759
    Likes Received:
    6
    Device:
    iPhone 4 (White)
    Dont forget to tell me if it worked or not!
  5. pabloppp

    pabloppp New Member

    Joined:
    Feb 21, 2008
    Messages:
    53
    Likes Received:
    0
    What is the variable in this table to get the apllication name you have selected?
  6. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    hi first things first, it worked like a charm thanks that is exactly what i needed, onto pabloppp, sorry mate i dont get what you mean by that post, im still very new to all this.
  7. guaxinim

    guaxinim New Member

    Joined:
    Jan 25, 2008
    Messages:
    6
    Likes Received:
    0
    How to make it do something with the selected app? Like Open the app.

Share This Page