uitableview - iOS: scrollToRowAtIndexPath doesn't display correct top indexpath for last page -


i trying scroll tableview programmatically coded following. please note have increased content size can see few last few remaining rows. can scroll manually correctly required indexpath @ top programmatically it's not happening.

[tableview reloaddata];  cgsize size = tableview.contentsize; size.height += 1000; tableview.contentsize = size;  int rows = [tableview numberofrowsinsection:0]; int numberofrowsinview = 17; (int = 0; < ceil((float)rows/numberofrowsinview); i++) {     [tableview scrolltorowatindexpath:[nsindexpath indexpathforrow:i * numberofrowsinview insection:0] atscrollposition:uitableviewscrollpositiontop animated:no];     .... } 

for total rows 60, expect code return cell views of 0-16, 17-33, 34-50, 51-59 last scroll returns 43-59 i.e. full 17 rows view while based on above code, top indexpath should 51 last page!

can please me sort out. thanks.

this manually scrolling image:

manually scrolling

this done programmatically:

programmatically scrolling

if 17 rows fit on screen can't scroll less 17 items shown. so, table view take row have requested @ top , scroll nearest 1 means view 'full' of rows. it's because 60 isn't (exactly) divisible 17 table view won't let show half 'page'.


alternatively, can try using scroll view method setcontentoffset:animated: based on frame of cell want @ top (rectforrowatindexpath:).


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -