iOS - Scrolling to the top of a UITableView -


this question has answer here:

in app there uitableview 6 sections. while number of rows increasing, think user should have option scroll top of tableview. thinking including button on title header perform scrolling action. have seen in similar question problem here:

ios scroll section in uitable view

but don't know include code given in answer question , don't know put param insection:

nsindexpath * indexpath = [nsindexpath indexpathforrow:row insection:section]; [_tableview scrolltorowatindexpath:indexpath atscrollposition:uitableviewscrollpositiontop animated:yes] 

any welcome.

//assuming want scroll top of current section: 

i advise private variable save indexpath of current cell. in button in top, when user wants go top of section, can access section indexpath.

//in .m file @ top @property(nonatomic, assign) nsindexpath *pathsofar; 

remember instantiate it. can set in cellforrowatindexpath, , let uibutton in navigation access self.pathsofar.section piece of code have.

btw, assumes want scroll top of particular section , not top. if (scroll top) use 0 section , row.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -