conclusion
Use UIScrollView#scrollViewDidScroll
Check weather page changed in this func, then fire action if true.
memo
UICollectionViewCell's state
UICollectionViewCell instance has two state.
- isSelected
- isHighlighted
ref:
https://developer.apple.com/documentation/uikit/uicollectionviewcell
But it's not useful for this purpose
UIFocusEnvironment
At first, "focus" is useful I think.
But my colleague says it may not be used often.
I searched for this usecase.
use it when change focus manually.