I have rotated my table view by 90°. Now I want to get indexpath of middle cell. When table view is not scrolling, it is showing 3 cells. What I want is, when table view stops scrolling, it should middle cell of green color. Sometimes I get wrong indexpath when more then 3 cells are visible while fast scrolling.
I have attached image for reference
Asked
Active
Viewed 862 times
0

rmaddy
- 314,917
- 42
- 532
- 579

Bhanupriya
- 1,202
- 1
- 9
- 20
-
4Are you seriously using a table view? Why aren't you using a collection view? – nhgrif May 07 '14 at 11:36
-
@nhgrif , actually it a infinite scrolling table view. I have used following link for this: http://stackoverflow.com/questions/10404116/uitableview-infinite-scrolling and answer given by Frank Gorman. Now at the end of project, we can not change approach. Any help would be appreciated. – Bhanupriya May 09 '14 at 12:43
2 Answers
2
try this
NSIndexPath *middleIndexPath = [tableView indexPathForRowAtPoint:CGPointMake(tableView.center.y, tableView.center.x)];
UITableViewCell *middleCell = [tableView cellForRowAtIndexPath:middleIndexPath];

Vijay-Apple-Dev.blogspot.com
- 25,682
- 7
- 67
- 76
-
-
CGPointMake(tableView.center.x, tableView.center.y) try this – Vijay-Apple-Dev.blogspot.com May 09 '14 at 13:10
0
You can get contentOffset of table view. With contentOffset, you can calculate current row (contentOffset.y / row height)

huynguyen
- 7,616
- 5
- 35
- 48