I need to detect that an iOS Table is empty. This code:
Dim i as Integer
i = TableCLUBS.RowCount(0)
Yields a value of 2147483647 in the simulator when the table is empty. If you look at this value in HEX it is 0x7FFFFFFF which is all 1 bits except the high order bit.
Comparing to 2147483647 just does not seem correct to detect an empty table but I suppose it will work.
Using the same code to get TableCLUBS.SectionCount returns the same number for an empty table.
I have tried to declare and load the value into an int32 and int64 with the same result. An Int16 returns minus 1.
Seems like i is returning unsigned, regardless what you specify (except in the case of int16) and wrapping around due to the return being a negative value.
Can somebody create a simple app with different integer types on iOS… assign it as -1… and print the return? This should show if there is an underlying framework conversion issue. I was going to assume it was the return on the tableCLUBS object… but int16 worked.
My advice, use int16 for now. Don’t use the detection for the wraparound value as it is the unexpected result and will break your code once this is resolved.