This is really just the same function you see in the iOS Contacts List. When you touch the status bar the table view will scroll, fast, to the top of the list. This is done with a display object at the top used to detect the touch on the status bar.
Take the WidgetDemo code, or my previous post “iOS Style Alpha Strip”, and insert the following code at line 66, to include the last line:
[lua]–[[Scroll to top touch bar]]–
local scrollToTop = display.newRect( 0, 0, display.contentWidth, display.statusBarHeight )
function scrollToTop:touch( event )
list:scrollToIndex( 1, 200 )
end
scrollToTop:addEventListener( “touch”, scrollToTop )
–[[End of Scroll to top touch bar]]–
– create a gradient for the top-half of the toolbar
local toolbarGradient = graphics.newGradient( {168, 181, 198, 255 }, {139, 157, 180, 255}, “down” )[/lua]
I have left the toolbarGradient in so you can more easily find where to place the inserted code, but as long as it is added after the list variable is declared, it will work.
Once it is added, just scroll the tableView down and touch the status bar. The tableView will then scroll to the first position.
My previous post can be found here:
https://developer.anscamobile.com/forum/2012/06/06/ios-style-alpha-strip [import]uid: 8271 topic_id: 27232 reply_id: 327232[/import]
[import]uid: 52491 topic_id: 27232 reply_id: 110614[/import]