uitableview - Round Top Corners of a UIView in Swift -


i trying round top corners using below code

func roundcorners(corners:uirectcorner, radius: cgfloat) {         let path = uibezierpath(roundedrect: self.bounds,                                 byroundingcorners: corners,                                 cornerradii: cgsize(width: radius, height: radius))         let masklayer = cashapelayer()         masklayer.frame = self.bounds         masklayer.path = path.cgpath         self.layer.mask = masklayer     } 

use myview.roundcorners(corners:[.topleft, .topright], radius: radius)

but it's rounding 1 side of view:
enter image description here

this in tableview sectionheader if scroll down rounded using same code: enter image description here

and top discount view corners rounded using same function.

thank's help.

update if fix width on view works fine.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -