SFFocusViewLayout icon indicating copy to clipboard operation
SFFocusViewLayout copied to clipboard

Using last visible cell as Focused View?

Open gauravlnx opened this issue 9 years ago • 7 comments

Hi,

What do I need to do if I want to make the last visible cell as the focused view instead of the first visible cell?

Thanks

gauravlnx avatar Aug 08 '16 06:08 gauravlnx

@fdzsergio @gauravlnx

Hi Gaurav,

Did you find anything ? Because I want exactly same that you want.

Please help me if you found or just suggest me how can we achieve the same.

Thanks

ektapadaliya avatar Sep 14 '16 07:09 ektapadaliya

@EMakadiya Sorry. I haven't found anything about it yet. I tried to create it manually but unable to figure out the location of the cells in relation to the content offset.

gauravlnx avatar Sep 14 '16 07:09 gauravlnx

@gauravlnx Okay Let me try. Thanks.

ektapadaliya avatar Sep 14 '16 08:09 ektapadaliya

Please let me know if solved. :)

gauravlnx avatar Sep 14 '16 08:09 gauravlnx

@gauravlnx Sure will let you know. Can you please tell me that what you tried?

Till Now I understand that they are changing the frame of all items according to offset.

ektapadaliya avatar Sep 14 '16 09:09 ektapadaliya

I can't remember exactly what I did but mainly I tried to calculate the size and prosition and cells in prepareLayout() method. I tried to calculate in reverse also i.e. last cell at the bottom( of contentSize) and previous cell just above it.

I far I am able to understand, main changes have to be made in the following methods:

  1. prepareLayout(): to calculate layout attributes for each cell.
  2. currentFocusedItemIndex: This variable should return the focused index which is currently at the bottom of the screen.
  3. nextItemPercentageOffset: a value between 0 and 1 that represents how close the previous cell is to becoming the featured cell
  4. targetContentOffsetForProposedContentOffset() : This methods tell where the content offset should be when released

gauravlnx avatar Sep 14 '16 10:09 gauravlnx

@gauravlnx I solved by my self.

  1. Rotate tableview
  2. Rotate tableview cell again.

ektapadaliya avatar Sep 23 '16 07:09 ektapadaliya