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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -