ios - Detect device rotation inside a collectionViewCell -
inside custom collectionvirewcell create gradient layer , add cell in function override func awakefromnib() {}
self.layer.insertsublayer(gradient, at: 0) when device rotates size of cell changes not size of layer. need
override func viewdidlayoutsubviews() { gradient.frame = self.bounds }
the problem error telling me viewdidlayoutsubviews() did not override function superclass. there method detect cell size variation inside cell class?
viewdidlayoutsubviews() uiviewcontroller method , not method of uiview uicollectionviewcell inherits from.
the method you're looking override layoutsubviews()
override func layoutsubviews() { <#code#> } i think that's problem!
wiki
Comments
Post a Comment