ios - UITableView scroll to element programmatically -
i have array of 20 elements, , table view can show 5 of them. on start of view, selecting 1 item, , want show item in table view selecting it. when choose 1 of first 5, selection visible. when select 5+ element, want element visible moving content offset. how can scroll tableview
specific element list inside tableview array? in function of table view delegate do that?
i tried setting content offset, , scrolltorowatindexpath
inside cellforrowatindexpath
method, not working correctly. ideas?
calling scrolltorowatindexpath: @ cellforrow not work..first need reload data of tableview , need call below after selecting item..
nsindexpath *indexpath = [nsindexpath indexpathforrow:selectedrow insection:0]; [self.tableview reloaddata]; [self.tableview scrolltorowatindexpath:indexpath atscrollposition:uitableviewscrollpositiontop animated:yes];
hope helps you..
Comments
Post a Comment