0

I have a UITableview on the left of a split screen on landscape mode which has two types of cells.

Type-1 cells are similar and type-2 cells occur at definite intervals between type-1 cells which contain ADs.

Whenever i click the type-1 cell it should stand in the middle of screen in landscape mode. My code works fine till the first type-2 cell is loaded.

When the next type-2 cell is loaded, the selected Type-1 cell won't stay at the middle. It goes one step downwards each time a type-2 cell is seen on scrolling. How to get the selected type-1 cell in the middle of the seen tableview? ie., after every type-2 cell loaded, the value "IN_objIndexPath" in scrollToRowAtIndexPath should be updated as I scroll. How can I do this? Pardon my mistakes. Thank you

self.m_tblList.scrollToRowAtIndexPath(IN_objIndexPath, atScrollPosition: UITableViewScrollPosition.None, animated: true)
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
vensM
  • 73
  • 1
  • 5
  • try changing the `UITableViewScrollPosition.None` by `UITableViewScrollPosition.Middle` – Reinier Melian Nov 22 '17 at 11:12
  • If I do this, the selected cell appears in the middle till the first type-2 cell loads. Again if I select after type-2 cell has loaded, this selected cell won't stay at the middle. I goes one step down. – vensM Nov 22 '17 at 11:14
  • Your code sample here is not reproducible, you should try to define the smallest amount of code that will allow others to reproduce the issue you are seeing. In spite of this it looks like IN_objIndexPath is not calculated correctly. – Tristan Burnside Nov 22 '17 at 13:38

0 Answers0