ios - How to get the size of a UICollectionView cell before rotation -
i have uicollectionview has width percentage of it's parent. when rotates need know size going be, can invalidate layout , redraw collection view cells new full width. using viewwilltransitiontosize:withtransitioncoordinator: method, size returns of entire screen. there easy way new frame of uicollectionview before orientation change takes effect?
override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { super.viewwilltransitiontosize(size, withtransitioncoordinator: coordinator) print(self.collectionview.frame) // old frame coordinator.animatealongsidetransition({ (uiviewcontrollertransitioncoordinatorcontext) -> void in }) { (uiviewcontrollertransitioncoordinatorcontext) -> void in print(self.collectionview.frame) // new frame } }
Comments
Post a Comment