iOS Question TableView AutoScale

aminoacid

Active Member
Licensed User
Longtime User
I have a layout in Designer which I have setup to work for all iphone and ipad portrait orientations by setting the anchors appropriately. Everything works great with the views that were added in designer because I could set the parent and anchors appropriately for each view. All the views get AutoScaled and positioned properly in the ipad and iphone screens, except....

There is one view in my layout, "TableView" which is not setup in Designer but is added in code. It does not get positioned properly in the ipad screen because I think I need to set the anchors and parent properly as I did with the views added in Designer. However I can't seem to find any property in code or any way in Designer to do this. Here is my code to add tableview:

S_L=Label1.Left
S_T=Label1.Top+Label1.Height
S_W=Label1.Width
S_H=270

TableView1.Initialize("TableView1",False)
Page1.RootPanel.AddView(TableView1, S_L, S_T, S_W, S_H) 'left,top,width,height

The parent of Label1 is a panel called "panel1" and not "main". BTW all the views have "panel1" as parent so that they can be centered properly for different screen sizes using a designer script. The TableView gets positioned properly for the base variant (I have only one variant) but is offset to the left edge for other screen sizes. Hence I presume it's because I need to set its parent to panel1 also. Question is, how do I do it? And also, how do I set the anchors as one would do in Designer.

Would appreciate any advise on this. Thanks!
 

aminoacid

Active Member
Licensed User
Longtime User
Nice! This makes it much easier.
Unfortunately when investigating TableView, one of the first posts I came across mentioned that it had to be added in code since it was not available in Designer. So I didn't bother looking into CustomViews and the iUI8 Library.

Thanks for the quick response, Erel
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
Erel,
I went about adding TableView via the designer using iUI8 (V1.5). Also made sure to remove the reference to the old TableView Lib and set MinVersion to 8. I wrote some very simple test code below to display two lines in the Tableview. It works but when I add the statement "tableview1.Visible=False", the view does not disappear. Instead it is displayed as a blank box without any text in the lines. The only View on the page is TableView1.


'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait
#iPadOrientations: Portrait
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 8
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private tableview1 As TableView

End Sub

Private Sub Application_Start (Nav As NavigationController)
'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
Page1.RootPanel.LoadLayout("tvt")
NavControl.ShowPage(Page1)

tableview1.AddSingleLine("Item1")
tableview1.AddSingleLine("Item2")

tableview1.Visible=False <------------ THIS STATEMENT DOES NOT SEEM To WORK
End Sub


EDIT: I confirmed that setting Visible=False does not completely work. It clears the list but if the TableView has a border or a background color (other than transparent), the view will still be visible.

Is this a bug? Or am I missing something? It worked fine before when I was adding TableView in code using the old tableview library.

Thanks!
 
Last edited:
Upvote 0
Top