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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -