iOS Question custom list view height (and width)

Discussion in 'iOS Questions' started by Albi, May 10, 2015.

  1. Albi

    Albi Active Member Licensed User

    Hello,

    I have a custom list view and when I select one of the items, it goes to page5 with a customListView (clv3a).

    height
    I have a case statement for deciding what to populate clv3a with. Once the text is set (textDesc as string), I use the following code to populate the clv:

    Code:
    clv3a.Initialize(Me, "clv3a"100%x)
        Page5.rootPanel.AddView(clv3a.AsView,
    0,40,100%x,100%y)
        clv3a.AddTextItem(txtDesc, 
    1)
    However, when it is created, if it is larger than the previous text that was the there, the label height is the same height as it was previously. If I go back and into it again, it is now the right height.
    It still scrolls fine, so the content height is set ok.
    I took logs of the label height and contentheight within the custom class and they matched up, both when it was the 'wrong' height and the right height!

    I tried adding this to the bottom of the code above hoping that would fix it but it did not.

    Code:
    clv3a.Clear
        clv3a.AddTextItem(txtDesc, 
    1)
    any ideas what to try?

    i'd rather not upload the whole project as i'm making it for someone else, but obv will if it's really necessary!

    width
    with regards to the width, if i initialise it as follows:
    Code:
    clv3a.Initialize(Me, "clv3a"100%x-20)
        Page5.rootPanel.AddView(clv3a.AsView,
    10,40,100%x,100%y)
        clv3a.AddTextItem(txtDesc, 
    1)
    so that the clv has some slight borders with the edge of the page, it doesn't resize the content width and some text is cropped from the right hand side, within the view. i tried
    Code:
    clv3a.Initialize(Me, "clv3a"100%x-20)
        Page5.rootPanel.AddView(clv3a.AsView,
    10,40,100%x-20,100%y)
        clv3a.AddTextItem(txtDesc, 
    1)
    but that resized the view every time i went back into it making it smaller and smaller each time...

    thanks for any help!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please try to create a minimal example and upload it.
     
  3. Albi

    Albi Active Member Licensed User

    mwe attached.
    if you go to the third tab (it's a tableview), and choose the 1st option, the clv text will be the right size. then if you go back and choose 2nd or 3rd option, you'll see the clv text is the wrong size (but it scrolls nicely!). Go back and then into the same option, and it will be the perfect size.

    line 159
    Code:
    Page5.rootPanel.AddView(clv3a.AsView,0,40,100%x,100%y)
    was where i tried to adjust the left to 10 and have the width as 100%x-20 but then it didn't fit in the page horizontally.

    thanks!
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    The problem is that %x and %y are only guaranteed to be correct in Page_Resize event. I think you should split it into several classes (or modules) to make it more organized.

    Instead of using %x and %y you can use the current page size (not page 5).
     
  5. Albi

    Albi Active Member Licensed User

    thanks for the reply, that worked nicely.

    and i do need to work on coding organization (lack of) skills!
     
  6. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice