I just discovered a strange bug regarding the handle of cells.
At first I wasn’t using an iOSTableViewDataSource.
Creating the cells directly in the iOSTable Open event.
When creating the cells, I use these declares to change the Text word wrap:
Dim label As Ptr
declare function getTextLabel lib “UIKit” selector “textLabel” (obj_ref as ptr) as ptr
label = getTextLabel(cell.Handle)
Declare sub setLineBreakMode lib UIKitLib selector “setLineBreakMode:” (id as ptr, value as NSLineBreakMode)
setLineBreakMode label, BreakValue
Declare sub setNumberOfLines lib UIKitLib selector “setNumberOfLines:” (id as ptr, value as integer)
setNumberOfLines label, 3[/code]
But now that I’m using a DataSource, it seems that each iOSTableViewCell created in the RowData function have an empty handle : &h00000000
So the above declares don’t work anymore.
Is there a workaround for this ?
How do you create the cell? The problem is going to be that the ones you create in the row data event will (most likely - it would be nice to get an insight into the implementation here) be cached by the system from a generic template, so I’m not sure there is a way to properly work around this. Maybe if you make a custom cell and use that instead and have the settings you need applied by a control in the cell instead of in the RowData function? I just guessing here though so I might be completely off base.
Basically the cell is created like this:
[code]cell = table.CreateCell(dic.Lookup(“text”, “”), dic.Lookup(“detail”, “”))
cell.Tag = dic.Lookup(“tag”, nil)
dic is a Dictionary from another Dictionary that holds all Section names.
Thank you for your suggestion Jason. Using an iOSCustomTableCell I can change the Label word wrap and text size more easily.
I didn’t realise that the Cells were cached from a generic template, thus not having a handle until they are displayed by the table.
[quote=309316:@JrmieLeroy]Thank you for your suggestion Jason. Using an iOSCustomTableCell I can change the Label word wrap and text size more easily.
I didn’t realise that the Cells were cached from a generic template, thus not having a handle until they are displayed by the table.[/quote]
Great, I’m glad that solved it!