As has been remarked from time to time here, since iOS 7 using scrollToItem on a ListView no longer scrolls the selected item to the middle of the list (assuming there are enough list items to allow it to do so). It usually end up down the bottom.
However by hacking the Objective-C class TiUIListViewProxy.m it seems possible to achieve what we want. But is there a good reason Appcelerator have prevented this and how dangerous is it to make this hack for a production app?
I am not an expert at Objective-C (which is why I use Appcelerator!) but know enough to achieve simple hacks. Line 385 is setting the variable scrollPosition to 'ScrollPositionNone', but if we edit line 395:
[self.listView.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated];
And change the scrollPosition variable to UITableViewScrollPositionMiddle as per:
[self.listView.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:animated];
Now doing a scrollToItem positions to the middle (not totally unsurprisingly).
Has anybody else tried this?
OSX 10.9.2 iOS 7.1.1 Titanium SDK version 3.2.3.GA