iOSTable ScrollToRowAtIndexPath declare not working on device anymore

I’ve been using the following code (which I’m pretty sure is either from iOSKit or iOSLib) for quite some time to scroll to a row/section of an iOSTable. It seems that some time recently, the code has broken and it doesn’t work on the device. Works perfectly fine in the simulator, but on the device it does nothing.

[code] // If the section/row is invalid then raise an
// OutOfBoundsException
If section > table.SectionCount - 1 Or _
section < 0 Or _
row > table.RowCount(section) - 1 Or _
row < 0 Then
Raise New OutOfBoundsException
End If

// Select the specified section/row

// scrollToRowAtIndexPath:atScrollPosition:animated:

Declare Function NSClassFromString Lib “Foundation” (classname As CFStringRef) As Ptr
Declare Function alloc Lib “Foundation” selector “alloc” (classRef As Ptr) As Ptr

// Create an instance of NSIndexPath with the section/row to select
// Get pointer to class
Dim NSIndexPath As Ptr = NSClassFromString(“NSIndexPath”)

// Create an instance
Dim rowPath As Ptr = alloc(NSIndexPath)

// Now initialize it with initWithIndex:(NSUInteger)index
// Note the trailing “:” is very important!
Declare Sub initPath Lib “Foundation” Selector “initWithIndex:” (id As Ptr, row As UInteger)
initPath(rowPath, section) // This is the section containing the row

// Append the row and get back a new IndexPath with both
// (NSIndexPath *)indexPathByAddingIndex:(NSUInteger)index
Declare Function addIndex Lib “Foundation” Selector “indexPathByAddingIndex:” (id As Ptr, row As UInteger) As Ptr
Dim fullPath As Ptr
fullPath = addIndex(rowPath, row) // This is the row to select

// Now scroll to the row in case it is off the screen
// (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath
// atScrollPosition:(UITableViewScrollPosition)scrollPosition
// animated:(BOOL)animated

Declare Sub scrollToRow Lib “UIKit” Selector “scrollToRowAtIndexPath:atScrollPosition:animated:” (id As Ptr, row As Ptr, scrollPosition As UInteger, animated As Boolean)
scrollToRow(table.Handle, fullPath, 2, false)

I’ve also tried replacing the lib name with UIKit.framework and replacing Foundation with Foundation.framework.

Anyone know how to fix this so I can have this functionality without having to load in an entire iOSKit/iOSLib into the project?


That might be from the Xojo examples (it’s definitely not from iOSKit at least). Maybe check them to see if something changed slightly in your code which is affecting this.

In the letter to Santa department :
36918 - iOSTable ScrollPosition

Would it not be nice ?