iOS Question iTableView Orientation Resize Problem

Discussion in 'iOS Questions' started by RichardN, Aug 28, 2015.

  1. RichardN

    RichardN Active Member Licensed User

    I have an iTableView containing custom cells. Both TableView and cells refuse to resize correctly on reorientation... I feel I am making a schoolboy error somewhere. The custom cells remain the width of orientation at first run and the TableView1 behaves the same way in height. What am I doing wrong?

    Code:
    NavControl = Nav
    PageMain.Initialize(
    "PageMain")
    NavControl.ShowPage(PageMain)

    TableView1.Initialize(
    "TableView1"False)
    PageMain.RootPanel.AddView(TableView1, 
    00100%x100%y)
    TableView1.RowHeight = 
    50
      
    Dim tc As TableCell
      
    tc = TableView1.AddSingleLine(
    "")
    tc.ShowSelection = 
    False
    tc.CustomView = CreateItem(
    "sectiontitle","A_Title",Null)         'one of 3 different layouts loaded

    tc = TableView1.AddSingleLine(
    "")
    tc.ShowSelection = 
    False
    tc.CustomView = CreateItem(
    "genericselect","Display Me","TagText")

    Private Sub CreateItem (Layout As String, Caption As String, Callback As StringAs Panel
      
       
    Dim p As Panel
       p.Initialize(
    "")
       p.Width = 
    100%x
       p.Height = TableView1.RowHeight
       p.LoadLayout(Layout)
       lblCaption.Text = Caption
       
    If Layout = "genericselect" Then imgArrow.Tag = Callback
       
    Return p

    End Sub


    Private Sub Page1_Resize(Width As Int, Height As Int)
      
       TableView1.SetLayoutAnimated(
    4000.500100%x100%y)
      
       
    For Each tc As TableCell In TableView1.GetItems(0)
         tc.CustomView.Width = 
    100%x
       
    Next
     
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload this project?
     
  3. Derek Johnson

    Derek Johnson Active Member Licensed User

    The Page Resize sub has the wrong name it should be

    Code:
    Private Sub PageMain_Resize(Width As Int, Height As Int)
       
    Log("Resize to " & Width & "W x " & Height & "H")
       TableView1.SetLayoutAnimated(
    4000.500100%x100%y)

       
    For Each tc As TableCell In TableView1.GetItems(0)
         tc.CustomView.Width = 
    100%x
       
    Next

    End Sub
    Derek
     
    Erel likes this.
  4. RichardN

    RichardN Active Member Licensed User

    Doh! :(

    Many thanks Derek. That was precisely the sort of schoolboy error I was referring to.
     
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