uicollectionview - targetContentOffset(forProposedContentOffset:) in my CustomFlowLayout not called -
i writing custom uicollectionviewflowlayout overrides targetcontentoffset(forproposedcontentoffset:) in order provide right contentoffset when user pinch zoom since problem (wrong contentoffset)
dynamically setting layout on uicollectionview causes inexplicable contentoffset change
class timelinecollectionviewflowlayout: uicollectionviewflowlayout { // mark: - init override init() { super.init() self.minimumlinespacing = 0 } required init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override func prepare() { if let collectionview = self.collectionview { collectionview.ispagingenabled = false self.sectioninset = uiedgeinsets(top: 0, left: 0, bottom: 0, right: 0) self.scrolldirection = .horizontal } } override func targetcontentoffset(forproposedcontentoffset proposedcontentoffset: cgpoint) -> cgpoint { print("hello") return proposedcontentoffset } }
but unfortunatly targetcontentoffset not called, have idea why?
thanks!
thierry
try
override func targetcontentoffset(forproposedcontentoffset proposedcontentoffset: cgpoint, withscrollingvelocity velocity: cgpoint) -> cgpoint
Comments
Post a Comment